public static ecom_ProductGroups ConvertToProductGroupModel(CreateProductGroupPostRequest productGroupRequest) { var group = new ecom_ProductGroups() { Id = productGroupRequest.Id, Name = productGroupRequest.Name, Status = productGroupRequest.Status, Description = productGroupRequest.Description }; return(group); }
public ActionResult Create(CreateProductGroupPostRequest group) { if (ModelState.IsValid) { bool isSuccess = service.AddProductGroup(group.ConvertToProductGroupModel()); if (isSuccess) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("ServerError", "Add new brand fail!"); } } return(View(group)); }