public static void UpdateAction(this Model.Models.Action action, ActionVm actionVm)
 {
     action.Id          = actionVm.Id;
     action.Name        = actionVm.Name;
     action.Link        = actionVm.Link;
     action.ParentId    = actionVm.ParentId;
     action.Description = actionVm.Description;
     action.Display     = actionVm.Display;
     action.Position    = actionVm.Position;
     action.CreatedBy   = actionVm.CreatedBy;
     action.CreatedDate = actionVm.CreatedDate;
     action.Icon        = actionVm.Icon;
 }
Exemple #2
0
 public ActionResult Create(ActionVm actionVm)
 {
     if (ModelState.IsValid)
     {
         var newAction = new Model.Models.Action();
         newAction.UpdateAction(actionVm);
         newAction.CreatedDate = DateTime.Now;
         newAction.CreatedBy   = 1;
         _actionService.Add(newAction);
         _actionService.Save();
         TempData["MessageSuccess"] = Message.CreateSuccess;
         return(RedirectToAction("Index"));
     }
     TempData["MessageError"] = Message.CreateError;
     ViewBag.ParentId         = new SelectList(_actionService.GetAll(), "Id", "Name");
     return(View());
 }
 public void Delete(Model.Models.Action entity)
 {
     _actionRepository.Delete(entity.Id);
 }
 public void Update(Model.Models.Action entity)
 {
     _actionRepository.Update(entity);
 }
 public void Add(Model.Models.Action entity)
 {
     _actionRepository.Add(entity);
 }