Beispiel #1
0
 public void EditFAQ(AdminFaqVM editedFAQ, int id)
 {
     FAQ model;
     using (ApplicationDbContext db = new ApplicationDbContext())
     {
         model = db.FAQS.FirstOrDefault(x => x.FaqID == id);
         model.HardwareID = editedFAQ.HardwareID;
         model.Topic = editedFAQ.Topic;
         model.Question = editedFAQ.Question;
         model.Answer = editedFAQ.Answer;
         model.DateDeleted = editedFAQ.DateDeleted;
         db.SaveChanges();
     };
 }
 public IHttpActionResult Post(AdminFaqVM solution, int id)
 {
     _adapter.DeleteFAQ(id);
     return Ok();
 }
 public IHttpActionResult Post(AdminFaqVM editedFAQ, int id)
 {
     _adapter.EditFAQ(editedFAQ, id);
     return Ok();
 }
 public void EditFAQ(AdminFaqVM faq, int id)
 {
     using (ApplicationDbContext db = new ApplicationDbContext())
     {
         FAQ model;
         model = db.FAQS.FirstOrDefault(x => x.FaqID == id);
         model.Answer = faq.Answer;
         model.DateDeleted = null;
         model.Question = faq.Question;
         model.Topic = faq.Topic;
         model.HardwareID = faq.HardwareID;
         db.SaveChanges();
     }
 }
Beispiel #5
0
 public void newFAQ(AdminFaqVM newFAQ, int id)
 {
     FAQ model = new FAQ();
     Hardware hardwareModel;
     using (ApplicationDbContext db = new ApplicationDbContext())
     {
         hardwareModel = db.Hardware.FirstOrDefault(x => x.HardwareID == id);
         model.HardwareID = id;
         model.Topic = newFAQ.Topic;
         model.Question = newFAQ.Question;
         model.Answer = newFAQ.Answer;
         hardwareModel.Faq.Add(model);
         db.SaveChanges();
     }
 }
 public IHttpActionResult Post(AdminFaqVM faq, int id)
 {
     _adapter.EditFAQ(faq, id);
     return Ok(faq);
 }