コード例 #1
0
ファイル: FAQAdapter.cs プロジェクト: giorosati/envision4it
 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();
     };
 }
コード例 #2
0
 public IHttpActionResult Post(AdminFaqVM solution, int id)
 {
     _adapter.DeleteFAQ(id);
     return Ok();
 }
コード例 #3
0
 public IHttpActionResult Post(AdminFaqVM editedFAQ, int id)
 {
     _adapter.EditFAQ(editedFAQ, id);
     return Ok();
 }
コード例 #4
0
 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();
     }
 }
コード例 #5
0
ファイル: FAQAdapter.cs プロジェクト: giorosati/envision4it
 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();
     }
 }
コード例 #6
0
 public IHttpActionResult Post(AdminFaqVM faq, int id)
 {
     _adapter.EditFAQ(faq, id);
     return Ok(faq);
 }