public ActionResult Update(PlatformTypeViewModel platformTypeViewModel) { if (ModelState.IsValid) { var platformTypeDTO = _mapper.Map <ExtendPlatformTypeDTO>(platformTypeViewModel); if (!_platformTypeService.IsUniqueEnName(platformTypeDTO)) { ModelState.AddModelError("NameEn", GlobalRes.ExistPlatformTypeName); } if (platformTypeViewModel.NameRu != null) { if (!_platformTypeService.IsUniqueRuName(platformTypeDTO)) { ModelState.AddModelError("NameRu", GlobalRes.ExistPlatformTypeName); } } if (ModelState.IsValid) { _platformTypeService.Update(platformTypeDTO); return(RedirectToAction("GetAll")); } } return(View(platformTypeViewModel)); }
public IActionResult Edit(PlatformTypeEditViewModel viewModel) { PlatformType platformType = platformTypeService.GetByID(viewModel.PlatformType.ID); platformType.Name = viewModel.PlatformType.Name; platformTypeService.Update(platformType); return(RedirectToAction("Details", platformType)); }