コード例 #1
0
        public ActionResult Edit(int?Id)
        {
            var DocumentField = DocumentFieldRepository.GetDocumentFieldById(Id.Value);

            if (DocumentField != null && DocumentField.IsDeleted != true)
            {
                var model = new DocumentFieldViewModel();
                AutoMapper.Mapper.Map(DocumentField, model);
                if (model.Category == "Contract")
                {
                    model.DetailCategoryList = SelectListHelper.GetSelectList_Contract(model.CategoryId);
                }
                else if (model.Category == "LabourContract")
                {
                    model.DetailCategoryList = SelectListHelper.GetSelectList_LabourContract(model.CategoryId, App_GlobalResources.Wording.Empty);
                }
                else if (model.Category == "InternalNotifications")
                {
                    model.DetailCategoryList = SelectListHelper.GetSelectList_InternalNotifications(model.CategoryId, App_GlobalResources.Wording.Empty);
                }
                else
                {
                    model.DetailCategoryList = new List <SelectListItem>();
                }
                //if (model.CreatedUserId != Erp.BackOffice.Helpers.Common.CurrentUser.Id && Erp.BackOffice.Helpers.Common.CurrentUser.UserTypeId != 1)
                //{
                //    TempData["FailedMessage"] = "NotOwner";
                //    return RedirectToAction("Index");
                //}
                return(View(model));
            }
            if (Request.UrlReferrer != null)
            {
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
            return(RedirectToAction("Index"));
        }