Пример #1
0
 public ActionResult PostAdd(CategoryModel Models)
 {
     if (CSer.AddOrUpdate(Models) == true)
     {
         return(Content("1"));
     }
     else
     {
         return(View(Models));
     }
 }
Пример #2
0
 public ActionResult AddOrUpdate(Category category)
 {
     try
     {
         categoryService.AddOrUpdate(category);
         var responseModel = new ResponseModel
         {
             StatusCode = (int)HttpStatusCode.OK,
             MessageAr  = category.Id > 0 ? AppResource.UpdatedSuccessfully : AppResource.SavedSuccessfully
         };
         return(Json(responseModel, JsonRequestBehavior.AllowGet));
     }
     catch (System.Exception)
     {
         var responseModel = new ResponseModel
         {
             StatusCode = (int)HttpStatusCode.InternalServerError,
             MessageAr  = AppResource.ChangesNotSaved
         };
         return(Json(responseModel, JsonRequestBehavior.AllowGet));
     }
 }
        public async Task <ViewResult <CategoryModel> > AddOrUpdate(CategoryModel model)
        {
            var userName = User.Identity.Name;

            return(await _categoryService.AddOrUpdate(model, userName));
        }