public ActionResult Add(Master_Menu model)
 {
     try
     {
         IFunctionService svc = new FunctionService();
         model.MenuID = FunctionService.GenerateID();
         var result = svc.Add(model);
         this.AddNotification("Your Data Has Been Successfully Saved. ", NotificationType.SUCCESS);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         general.AddLogError("Function Add", ex.Message, ex.StackTrace);
         this.AddNotification("ID exist", NotificationType.ERROR);
         return(View("~/Views/Master/Function/Add.cshtml"));
     }
 }
Exemple #2
0
 public IActionResult SaveEntity(Function function)
 {
     if (!ModelState.IsValid)
     {
         IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors);
         return(new BadRequestObjectResult(allErrors));
     }
     else
     {
         //if (!_functionService.CheckItemExist(function.Id))
         if (string.IsNullOrWhiteSpace(function.Id))
         {
             _functionService.Add(function);
         }
         else
         {
             _functionService.Update(function);
         }
         _functionService.Save();
         return(new OkObjectResult(function));
     }
 }
Exemple #3
0
 public static int Add(Function fun)
 {
     return(FunctionService.Add(fun));
 }