Esempio n. 1
0
 public AdminSolutionVM AddSolution(int id, AdminSolutionVM solution)
 {
     Project project;
     Solution newSolution = new Solution()
     {
         SolutionName = solution.SolutionName,
         StartDate = solution.StartDate,
         Urgency = solution.Urgency,
         TargetCompletionDate = solution.TargetCompletionDate
     };
     using (ApplicationDbContext db = new ApplicationDbContext())
     {
         project = db.Projects.FirstOrDefault(x => x.ProjectID == id);
         project.Solutions.Add(newSolution);
         db.SaveChanges();
     }
     return solution;
 }
Esempio n. 2
0
 public AdminSolutionVM AddSolution(AdminSolutionVM solution, int id)
 {
     Solution model = new Solution()
     {
         ProjectID = id,
         DateDeleted = null,
         SolutionID = solution.SolutionID,
         SolutionName = solution.SolutionName,
         StartDate = solution.StartDate,
         TargetCompletionDate = solution.TargetCompletionDate,
         Urgency = solution.Urgency
     };
     using (ApplicationDbContext db = new ApplicationDbContext())
     {
         db.Solutions.Add(model);
         db.SaveChanges();
     }
     return solution;
 }
 public IHttpActionResult Post(AdminSolutionVM solution, int id)
 {
     _adapter.EditSolution(solution, id);
     return Ok();
 }
 public IHttpActionResult Post(AdminSolutionVM solution, int id)
 {
     _adapter.DeleteSolution(id);
     return Ok();
 }
Esempio n. 5
0
 public void EditSolution(AdminSolutionVM solution, int id)
 {
     using (ApplicationDbContext db = new ApplicationDbContext())
     {
         if (solution != null)
         {
             Solution model;
             model = db.Solutions.FirstOrDefault(x => x.SolutionID == id);
             model.SolutionName = solution.SolutionName;
             model.TargetCompletionDate = solution.TargetCompletionDate;
             model.Urgency = solution.Urgency;
             model.StartDate = solution.StartDate;
             db.SaveChanges();
         };
     };
 }
 public IHttpActionResult Post(int id, AdminSolutionVM solution)
 {
     AdminSolutionVM model = _adapter.AddSolution(id, solution);
     return Ok(model);
 }