コード例 #1
0
        public async Task <ActionResult> EditRiskDocument(RiskDocumentFormStub model)
        {
            ResponseModel response = new ResponseModel(true);

            Business.Entities.RiskDocument dbItem = new Business.Entities.RiskDocument();

            model.ModifiedBy   = User.UserName;
            model.ModifiedDate = DateTime.Now;

            RiskPresentationStub riskModel = new RiskPresentationStub();

            if (ModelState.IsValid)
            {
                dbItem = model.GetDbObject();
                await RiskDocumentRepo.UpdateAsync(dbItem);

                if (RiskDocumentRepo.Id != 0)
                {
                    return(Index(null));
                }
                else
                {
                    return(View("_FormRiskDocument", model));
                }
            }
            else
            {
                return(View("_FormRiskDocument", model));
            }
        }
コード例 #2
0
        private List <RiskPresentationStub> GoToIndex(int?year)
        {
            //kamus
            Session["target"] = "target125";
            List <RiskPresentationStub> risks = new List <RiskPresentationStub>();

            EnumHelper         eh       = new EnumHelper();
            List <SortingInfo> sortings = new List <SortingInfo>();

            //algoritma
            //if (year != null) risk.Year = year.Value;

            var filters = new Business.Infrastructure.FilterInfo
            {
                Logic   = "and",
                Filters = new List <Business.Infrastructure.FilterInfo>()
            };

            filters.Filters.Add(new Business.Infrastructure.FilterInfo
            {
                Field    = "Year",
                Operator = "eq",
                Value    = year.Value.ToString()
            });

            var sorting = new Business.Infrastructure.SortingInfo
            {
                SortOn    = "RiskId",
                SortOrder = "DESC"
            };

            sortings.Add(sorting);

            List <Business.Entities.Risk> risks_temp = RiskRepo.Find(null, null, sortings, filters, false);

            foreach (Business.Entities.Risk risk in risks_temp)
            {
                RiskPresentationStub riskPresentationStub = new RiskPresentationStub(risk);

                riskPresentationStub.RiskImpacts     = GetRiskImpacts(risk.RiskId);
                riskPresentationStub.RiskMitigations = GetRiskMitigations(risk.RiskId);

                risks.Add(riskPresentationStub);
            }

            return(risks);
        }