public IActionResult EditeMainCategory(MainCategoryEditedVM mainCategory) { if (mainCategory == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest()); } if (PService.UpdateMainCaregory(new MainCategory { EName = mainCategory.EName, IsActive = mainCategory.IsActive, Name = mainCategory.Name, OrderNumber = mainCategory.OrderNumber, MainCategoryId = mainCategory.MainCategoryId }, mainCategory.MainCategoryId)) { return(RedirectToAction("MainCategory")); } return(BadRequest()); }
public IActionResult EditeMainCategory(int?id) { if (id.HasValue) { var category = PService.GetMainCategory(id.Value); if (category != null) { MainCategoryEditedVM mainCategory = new MainCategoryEditedVM { EName = category.EName, IsActive = category.IsActive, MainCategoryId = category.MainCategoryId, Name = category.Name, OrderNumber = category.OrderNumber }; return(View(mainCategory)); } } return(BadRequest()); }