예제 #1
0
        public ActionResult Edit(int id, string boxName = "", string message = "")
        {
            var model = _missionService.GetById(id);

            if (model == null)
            {
                throw new Exception("未知任务。");
            }
            ViewBag.BoxName       = boxName;
            ViewBag.Message       = message;
            ViewBag.UserGroup     = (CommonEnum.GroupOfCustomer)_customerService.GetEntityById(UserContext.Current.Id).GroupId;
            ViewBag.TypeOfPayment = _missionService.GetPaymentTypeList();
            if (model.Status >= (int)CommonEnum.StatusOfMission.Contract)
            {
                M_Contract c = _missionService.GetContractByMission(model.Id);
                if (c != null)
                {
                    C_File f = _fileService.GetById(c.FileId);
                    if (f != null)
                    {
                        ViewBag.ContractUrl = CommonContorllers.FILE_UPLOAD_MISSION_CONTRACT_PATH + f.FileName;
                    }
                }
            }
            if (model.Publisher != UserContext.Current.Id && model.Receiver != UserContext.Current.Id)
            {
                throw new Exception("未知的任务。");
            }
            return(View(model));
        }