Skip to content

Instantly share code, notes, and snippets.

@demonguru18
Created February 10, 2019 18:55
Show Gist options
  • Save demonguru18/3b309c4766214abf249e56e83ec9e016 to your computer and use it in GitHub Desktop.
Save demonguru18/3b309c4766214abf249e56e83ec9e016 to your computer and use it in GitHub Desktop.
Model Class For Product, LoginView and RegisterView
/* Login View */
using System;
using System.ComponentModel.DataAnnotations;
namespace JWT_NG.Models
{
public class LoginViewModel
{
[Required]
[Display(Name = "User Name")]
public string Username { get; set; }
[Required]
[DataType(DataType.Password)]
public string Password { get; set; }
}
/* Product View */
public class ProductModel
{
[Key]
public int ProductId { get; set; }
[Required]
[MaxLength(50)]
public string Name { get; set; }
[Required]
[MaxLength(150)]
public string Description { get; set; }
[Required]
public bool OutOfStock { get; set; }
[Required]
public string ImageUrl { get; set; }
[Required]
public double Price { get; set; }
}
/* Register View View */
public class RegisterViewModel
{
[Required]
[EmailAddress]
public string Email { get; set; }
[Required]
[Display(Name = "User Name")]
public string UserName { get; set; }
[Required]
[DataType(DataType.Password)]
public string Password { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment