public JsonResult AddAndEdit(BrandActionModel model) { JsonResult json = new JsonResult(); var result = false; if (model.BrandID > 0) { var brand = services.GetBrandByID(model.BrandID); brand.BrandName = model.BrandName; brand.UpdatedAt = DateTime.Now; result = services.UpdateBrand(brand); } else { Brand brand = new Brand(); brand.BrandName = model.BrandName; brand.UpdatedAt = DateTime.Now; result = services.SaveBrand(brand); } if (result) { json.Data = new { Success = true }; } else { json.Data = new { Success = false, Message = "Unable to perform action on Main Menu" }; } return(json); }