public void CreateCategory(CategoryEdit category) { Mapper.CreateMap<CategoryEdit, Category>(); Db.Categories.Create(Mapper.Map<CategoryEdit, Category>(category)); }
public void EditCategory(CategoryEdit category) { var existedCategory = Db.Categories.GetByID(category.CategoryId); existedCategory.Name = category.Name; existedCategory.IconName = category.IconName; existedCategory.BackgroundImgName = category.BackgroundImgName; existedCategory.HomeImgName = category.HomeImgName; Db.Categories.Update(existedCategory); }