public ProductCategory MapProductCategoryDTO(ProductCategoryDTO input) { ProductCategory output = new ProductCategory(); output.AgencyObjectCode = input.AgencyObjectCode; output.ComptrollerObjectCode = input.ComptrollerObjectCode; output.Description = input.Description; output.IsActive = input.IsActive; output.Notes = input.Notes; output.ProductCategoryId = input.ProductCategoryId; output.ProgramCostAccount = input.ProgramCostAccount; output.TransactionCode = input.TransactionCode; return output; }
public ActionResult ProductCategoryPost(ProductCategoryDTO productCategoryDTO) { if (!ModelState.IsValid) throw new HttpException(400, "Invalid data."); ProductCategory productCategory = _mapper.MapProductCategoryDTO(productCategoryDTO); if (_productCategoryService.Exists(productCategoryDTO.ProductCategoryId)) _productCategoryService.Update(productCategory); else _productCategoryService.Insert(productCategory); string myURL = string.Format("{0}#{1}", Url.Action("ProductsAndCategories"), productCategoryDTO.Description.ToLower().Replace(" ", "-")); return new RedirectResult(myURL); }