Skip to content

Commit

Permalink
fixed category and product models
Browse files Browse the repository at this point in the history
  • Loading branch information
dev7k committed Mar 28, 2019
1 parent 0f095f8 commit d498a3c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/ProductMicroservice/Model/Category.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
namespace ProductMicroservice.Model
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace ProductMicroservice.Model
{
public class Category
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }

[Required]
public string Name { get; set; }

[Required]
public string Description { get; set; }
}
}
16 changes: 15 additions & 1 deletion src/ProductMicroservice/Model/Product.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
namespace ProductMicroservice.Model
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace ProductMicroservice.Model
{
public class Product
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }

[Required]
public string Name { get; set; }

[Required]
public string Description { get; set; }

[Required]
[Column(TypeName = "decimal(10,2)")]
public decimal Price { get; set; }

[Required]
public int CategoryId { get; set; }
}
}

0 comments on commit d498a3c

Please sign in to comment.