Exemplo n.º 1
0
        public ActionResult ActionDelete(ModuleAction_Model moduleAction_Model)
        {
            var Action_Name = moduleAction_Model.ActionName;

            try
            {
                if (ModuleAction_.DeleteAction(moduleAction_Model.ModuleActionID))
                {
                    return(Json(Action_Name + " action has been deleted successfully"));
                }
                else
                {
                    return(Json("Error"));
                }
            }
            catch (Exception e)
            {
                return(Json("Error" + e.ToString()));
            }
        }
Exemplo n.º 2
0
 public ActionResult ActionAdd(ModuleAction_Model moduleAction_Model)
 {
     if (moduleAction_Model.ActionStatus == null || string.IsNullOrEmpty(moduleAction_Model.ActionName) || moduleAction_Model.ModuleID == null)
     {
         ViewBag.AddError = "Error";
         return(View("Action"));
     }
     else
     {
         if (ModuleAction_.SaveAction(moduleAction_Model))
         {
             Session["Success"] = moduleAction_Model.ActionName + " added successfully!!";
         }
         else
         {
             Session["Error"] = moduleAction_Model.ActionName + " couldn't be added please retry!!";
         }
         return(RedirectToAction("Action"));
     }
 }
 public bool UpdateAction(ModuleAction_Model action)
 {
     using (var _context = new SalesTrackingSystemEntities())
     {
         try
         {
             var data = _context.ModuleActions.Where(moduleActions => moduleActions.ModuleActionID == action.ModuleActionID).FirstOrDefault();
             data.ModuleID     = action.ModuleID;
             data.ActionName   = action.ActionName;
             data.ActionStatus = action.ActionStatus;
             data.Description  = action.Description;
             data.DateUpdated  = DateTime.Now;
             _context.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
Exemplo n.º 4
0
 public ActionResult ActionUpdate(ModuleAction_Model moduleAction_Model)
 {
     if (string.IsNullOrWhiteSpace(moduleAction_Model.ActionName) || moduleAction_Model.ModuleID == null || moduleAction_Model.ActionStatus == null)
     {
         ViewBag.UpdateError = "Error";
         ViewBag.UpdateData  = moduleAction_Model.ModuleActionID;
         return(View("Action"));
     }
     else
     {
         if (ModuleAction_.UpdateAction(moduleAction_Model))
         {
             Session["Success"] = moduleAction_Model.ActionName + " updated successfully!!";
             return(RedirectToAction("Action"));
         }
         else
         {
             Session["Error"] = moduleAction_Model.ActionName + " couldn't be updated please retry!!";
             return(View("Action"));
         }
     }
 }
 public bool SaveAction(ModuleAction_Model action)
 {
     using (var _dbContext = new SalesTrackingSystemEntities())
     {
         try
         {
             var data = new ModuleAction()
             {
                 ModuleID     = action.ModuleID,
                 ActionName   = action.ActionName,
                 ActionStatus = action.ActionStatus,
                 Description  = action.Description,
                 DateCreated  = DateTime.Now
             };
             _dbContext.ModuleActions.Add(data);
             _dbContext.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             throw;
         }
     }
 }