/// <summary> /// preserve catalogable attributes /// </summary> /// <param name="src"></param> /// <param name="target"></param> /// <returns></returns> public static IServiceOptionCategoryDto UpdateServiceCategory(ServiceCategoryAbbreviatedModel src, IServiceOptionCategoryDto target) { target.BusinessValue = src.BusinessValue; target.Popularity = src.Popularity; if (src.Code != null) { target.Code = src.Code.ToUpper(); } target.Quantifiable = src.Quantifiable; return(target); }
/// <summary> /// Save updates to category /// </summary> /// <param name="category"></param> /// <returns></returns> public ActionResult SaveServiceCategory(ServiceCategoryAbbreviatedModel category) { try { var existingCategory = _portfolioService.GetServiceOptionCategory(UserId, category.Id); //category to amend existingCategory = AbbreviatedEntityUpdate.UpdateServiceCategory(category, existingCategory); _portfolioService.ModifyServiceOptionCategory(UserId, existingCategory, EntityModification.Update); } catch (Exception exception) { TempData["MessageType"] = WebMessageType.Failure; TempData["Message"] = $"Failed to save category, error: {exception.Message}"; return(RedirectToAction("UpdateServiceCategory", new { id = category.Id })); } return(RedirectToAction("ShowOptionCategory", new { id = category.Id })); }