Esempio n. 1
0
        public RiskVM GetRisk(int riskId)
        {
            var model       = new RiskVM();
            var transformer = new RiskTransformer();

            using (var db = new ManagementToolEntities())
            {
                var resp = new RiskRepository(db);

                var risk = resp.GetFirstOrDefault(r => r.RiskId == riskId);
                model = transformer.Transform(risk);
            }

            return(model);
        }
Esempio n. 2
0
        public bool UpdateRisk(RiskVM model)
        {
            bool success = false;

            using (var db = new ManagementToolEntities())
            {
                var resp = new RiskRepository(db);

                var risk = resp.GetFirstOrDefault(r => r.RiskId == model.Id);

                risk.Status      = model.Status.ToString();
                risk.Description = model.Description;
                risk.Title       = model.Title;

                resp.Update(risk);
                success = db.SaveChanges() > 0;
            }

            return(success);
        }