コード例 #1
0
        public async Task <JsonResult> DeleteConfirmed(int id)
        {
            return(await ExecuteWithErrorHandling(async() =>
            {
                if (id == 0)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return Json("Bad Request", JsonRequestBehavior.AllowGet);
                }

                return await ExecuteResultAsync(async() => await ThuTucRepository.DeleteByAsync(id));
            }));
        }
コード例 #2
0
 public ActionResult Edit(int id)
 {
     return(ExecuteWithErrorHandling(() =>
     {
         var data = ThuTucRepository.Single(id);
         var init = IniViewModel();
         var model = new EditThuTucViewModel
         {
             CoQuanThucHienIds = data.CoQuanThucHienIds,
             LinhVucThuTucId = data.LoaiThuTucId,
             NgayBanHanh = data.NgayBanHanh,
             NoiDung = data.NoiDung,
             TenThuTuc = data.TenThuTuc,
             TapTinThuTucResults = data.Files,
             CoQuanInfos = init.CoQuanInfos,
             LinhVucThuTucInfo = init.LinhVucThuTucInfo,
         };
         return View(model);
     }));
 }
コード例 #3
0
        public ActionResult Edit(int id, EditThuTucViewModel model)
        {
            var data = ThuTucRepository.Single(id);

            data.LoaiThuTucId      = model.LinhVucThuTucId;
            data.CoQuanThucHienIds = model.CoQuanThucHienIds;
            data.NoiDung           = model.NoiDung;
            data.NgayBanHanh       = data.NgayBanHanh;
            data.TenThuTuc         = model.TenThuTuc;
            data.LastUpdatedBy     = UserName;

            var result = ThuTucRepository.Update(data);

            if (result == Services.SaveResult.SUCCESS)
            {
                SaveFiles(id, model.Files);
            }

            return(RedirectToRoute(UrlLink.THUTUC));
        }
コード例 #4
0
        public ActionResult Add(AddThuTucViewModel model)
        {
            var dataSave = new ThuTucResult
            {
                NoiDung           = model.NoiDung,
                TenThuTuc         = model.TenThuTuc,
                NgayBanHanh       = model.NgayBanHanh,
                LoaiThuTucId      = model.LinhVucThuTucId,
                CoQuanThucHienIds = model.CoQuanThucHienIds,
                CreatedBy         = UserName,
            };

            var result = ThuTucRepository.Add(dataSave);

            if (result == Services.SaveResult.SUCCESS && dataSave.Id > 0)
            {
                SaveFiles(dataSave.Id, model.Files);
            }

            return(RedirectToRoute(UrlLink.THUTUC_EDIT, new { tenthutuc = dataSave.TenThuTuc.RejectMarks(), id = dataSave.Id }));
        }
コード例 #5
0
        private IPagedList <ThuTucResult> Find(ValueSearchViewModel model)
        {
            var seachAll = ThuTucRepository.GetAll();

            if (!string.IsNullOrEmpty(model.ThuTucCongViec))
            {
                seachAll = seachAll.Where(x => x.TenThuTuc.Contains(model.ThuTucCongViec));
            }

            if (model.CoQuanThucHienIds != null && model.CoQuanThucHienIds.Any())
            {
                seachAll = seachAll.Where(x => x.CoQuanThucHienIds.Any(y => y == model.CoQuanId));
            }

            if (model.LinhVucThuTucId.HasValue)
            {
                seachAll = seachAll.Where(x => x.LoaiThuTucId == model.LinhVucThuTucId);
            }

            return(seachAll.ToPagedList(model.Page, TechOfficeConfig.PAGESIZE));
        }
コード例 #6
0
        public PartialViewResult Detail(int id)
        {
            var model = ThuTucRepository.Single(id);

            return(PartialView("_PartialPageDetail", model));
        }