public void EditCustomerNote(CustomerNoteVM customerNote, int id) { using (ApplicationDbContext db = new ApplicationDbContext()) { CustomerNote model; model = db.CustomerNotes.FirstOrDefault(x => x.CustomerNoteID == id); model.DateEntered = customerNote.DateEntered.Value; model.Note = customerNote.Note; model.UserID = customerNote.UserID; db.SaveChanges(); }; }
public CustomerNoteVM AddCustomerNote(string id, CustomerNoteVM customerNote) { CustomerNote newNote = new CustomerNote() { DateEntered = DateTime.Now, Note = customerNote.Note, UserID = id }; using (ApplicationDbContext db = new ApplicationDbContext()) { db.CustomerNotes.Add(newNote); db.SaveChanges(); } return customerNote; }
public IHttpActionResult Post(CustomerNoteVM customerNote, int id) { _adapter.EditCustomerNote(customerNote, id); return Ok(); }
public IHttpActionResult Post(string id, CustomerNoteVM customerNote) { CustomerNoteVM model = _adapter.AddCustomerNote(id, customerNote); return Ok(model); }