namespace AutoBuggi.Repository { public class CategoryRepository { //private object dbCategory; public Guid SaveCategory(Models.CarCategory model) { try { using (var dbcontext = new AutoBuggiEntities()) { var dbCategory = new Models.CarCategory() { Id = Guid.NewGuid(), CategoryId = model.CategoryId, VariantName = model.VariantName }; dbcontext.CarCategories.Add(dbCategory); dbcontext.SaveChanges(); } } catch(Exception) { } return Guid.Empty; } } }
namespace AutoBuggi.Models { public class CarCategory { public Guid Id { get; set; } public int CategoryId { get; set; } [DisplayAttribute(Name = "Variant Name")] public string VariantName { get; set; } } }
Repository.AutoBuggi.CarCategory
Models.CarCategory
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)