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 Get(string id) //{ // string userId = User.Identity.GetUserId(); // List<CustomerNoteVM> notes = _adapter.GetCustomerNotes(); // return Ok(notes); //} public IHttpActionResult Post(CustomerNoteVM note, int id) { _adapter.EditCustomerNote(note, id); return(Ok()); }
public IHttpActionResult Post(string id, CustomerNoteVM customerNote) { CustomerNoteVM model = _adapter.AddCustomerNote(id, customerNote); return(Ok(model)); }
public IHttpActionResult Get(int id) { CustomerNoteVM note = _adapter.GetCustomerNote(id); return(Ok(note)); }