public ActionResult SaveCategory(Category model) { try { if (model.ImageFile != null) { model.Image = Util.GetBase64FromImage(model.ImageFile); } model.ImageFile = null; if (model.Oid == Guid.Empty) { model.State = Entities.Enums.ItemState.Active; var res = ApiUtil.AddCategory(model).Result; } else { var res = ApiUtil.UpdateCategory(model).Result; } return(RedirectToAction("ListCategory")); } catch (System.Exception ex) { return(RedirectToAction("Index", new RouteValueDictionary(new { controller = "ErrorHandler", action = "Index", data = ex.InnerException?.Message ?? ex.Message }))); } }