public DetailsCategoryServiceModel GetById(int id) { var category = data.Categories .Find(id); var dcsm = new DetailsCategoryServiceModel() { Id = category?.Id, Name = category?.Name, Description = category?.Description }; return(dcsm); }
public DetailsCategoryServiceModel GetById(int id) { var category = this.data.Categories.Find(id); var detailServiceModel = new DetailsCategoryServiceModel { Id = category?.Id, Name = category?.Name, Description = category?.Description }; return(detailServiceModel); }
public DetailsCategoryServiceModel GetById(int id) { Category category = this.context.Categories.Find(id); DetailsCategoryServiceModel model = new DetailsCategoryServiceModel { Id = category?.Id, Name = category?.Name, Description = category?.Description, }; return(model); }
public IActionResult Edit(int id) { DetailsCategoryServiceModel category = this.categoryService.GetById(id); if (category.Name == null) { return(this.BadRequest()); } CategoryDetailsViewModel viewModel = new CategoryDetailsViewModel { Id = category.Id.Value, Name = category.Name, Description = category.Description, }; return(this.View(viewModel)); }