Esempio n. 1
0
 public ActionResult Create(ProcessViewModel model)
 {
     if (ModelState.IsValid)
     {
         var Process = new Domain.Crm.Entities.Process();
         AutoMapper.Mapper.Map(model, Process);
         Process.IsDeleted      = false;
         Process.CreatedUserId  = WebSecurity.CurrentUserId;
         Process.ModifiedUserId = WebSecurity.CurrentUserId;
         Process.CreatedDate    = DateTime.Now;
         Process.ModifiedDate   = DateTime.Now;
         processRepository.InsertProcess(Process);
         //lưu danh sách action sử dụng process
         foreach (var item in model.DetailList)
         {
             var action = new Domain.Crm.Entities.ProcessApplied();
             action.IsDeleted      = false;
             action.CreatedUserId  = WebSecurity.CurrentUserId;
             action.ModifiedUserId = WebSecurity.CurrentUserId;
             action.CreatedDate    = DateTime.Now;
             action.ModifiedDate   = DateTime.Now;
             action.ActionName     = item.ActionName;
             action.ModuleName     = item.ModuleName;
             action.ProcessId      = Process.Id;
             processAppliedRepository.InsertProcessApplied(action);
         }
         TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess;
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Esempio n. 2
0
        public ActionResult Create(ProcessAppliedViewModel model)
        {
            if (ModelState.IsValid)
            {
                var ProcessApplied = new ProcessApplied();
                AutoMapper.Mapper.Map(model, ProcessApplied);
                ProcessApplied.IsDeleted      = false;
                ProcessApplied.CreatedUserId  = WebSecurity.CurrentUserId;
                ProcessApplied.ModifiedUserId = WebSecurity.CurrentUserId;
                ProcessApplied.AssignedUserId = WebSecurity.CurrentUserId;
                ProcessApplied.CreatedDate    = DateTime.Now;
                ProcessApplied.ModifiedDate   = DateTime.Now;
                ProcessAppliedRepository.InsertProcessApplied(ProcessApplied);

                TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess;
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }