Esempio n. 1
0
        public ActionResult Edit(int?Id)
        {
            var Process = processRepository.GetProcessById(Id.Value);

            if (Process != null && Process.IsDeleted != true)
            {
                var model = new ProcessViewModel();
                AutoMapper.Mapper.Map(Process, model);

                //if (model.CreatedUserId != Erp.BackOffice.Helpers.Common.CurrentUser.Id && Erp.BackOffice.Helpers.Common.CurrentUser.UserTypeId != 1)
                //{
                //    TempData["FailedMessage"] = "NotOwner";
                //    return RedirectToAction("Index");
                //}
                model.CategorySelectList = Helpers.SelectListHelper.GetSelectList_Category("process_category", null, "Value", App_GlobalResources.Wording.Empty);
                model.EntitySelectList   = Helpers.SelectListHelper.GetSelectList_Module(null);
                //danh sách action sử dụng process
                model.DetailList = processAppliedRepository.GetAllProcessApplied().Where(x => x.ProcessId.Value == Process.Id)
                                   .Select(x => new ProcessAppliedViewModel
                {
                    ActionName = x.ActionName,
                    Id         = x.Id,
                    ModuleName = x.ModuleName,
                    ProcessId  = x.ProcessId
                }).ToList();
                return(View(model));
            }
            if (Request.UrlReferrer != null)
            {
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public ViewResult Index(string txtSearch)
        {
            IQueryable <ProcessAppliedViewModel> q = ProcessAppliedRepository.GetAllProcessApplied()
                                                     .Select(item => new ProcessAppliedViewModel
            {
                Id            = item.Id,
                CreatedUserId = item.CreatedUserId,
                //CreatedUserName = item.CreatedUserName,
                CreatedDate    = item.CreatedDate,
                ModifiedUserId = item.ModifiedUserId,
                //ModifiedUserName = item.ModifiedUserName,
                ModifiedDate = item.ModifiedDate,
                //  Name = item.Name,
            }).OrderByDescending(m => m.ModifiedDate);

            ViewBag.SuccessMessage = TempData["SuccessMessage"];
            ViewBag.FailedMessage  = TempData["FailedMessage"];
            ViewBag.AlertMessage   = TempData["AlertMessage"];
            return(View(q));
        }