public ActionResult SaveBrand(Brand 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.AddBrand(model).Result; } else { var res = ApiUtil.UpdateBrand(model).Result; } return(RedirectToAction("ListBrand")); } catch (Exception ex) { return(RedirectToAction("Index", new RouteValueDictionary(new { controller = "ErrorHandler", action = "Index", data = ex.InnerException?.Message ?? ex.Message }))); } }