public ActionResult DeleteConfirmed(int id) { NoteToService noteToService = db.NoteToServices.Find(id); db.NoteToServices.Remove(noteToService); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Note_idNote,Service_idService,date,AspNetUser_idAspNetUser")] NoteToService noteToService) { if (ModelState.IsValid) { db.Entry(noteToService).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AspNetUser_idAspNetUser = new SelectList(db.AspNetUsers, "Id", "Email", noteToService.AspNetUser_idAspNetUser); ViewBag.Note_idNote = new SelectList(db.Notes, "idNote", "note1", noteToService.Note_idNote); ViewBag.Service_idService = new SelectList(db.Services, "idService", "title", noteToService.Service_idService); return(View(noteToService)); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } NoteToService noteToService = db.NoteToServices.Find(id); if (noteToService == null) { return(HttpNotFound()); } return(View(noteToService)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } NoteToService noteToService = db.NoteToServices.Find(id); if (noteToService == null) { return(HttpNotFound()); } ViewBag.AspNetUser_idAspNetUser = new SelectList(db.AspNetUsers, "Id", "Email", noteToService.AspNetUser_idAspNetUser); ViewBag.Note_idNote = new SelectList(db.Notes, "idNote", "note1", noteToService.Note_idNote); ViewBag.Service_idService = new SelectList(db.Services, "idService", "title", noteToService.Service_idService); return(View(noteToService)); }
public ActionResult NoteToOrder(int?id) { Note newNote = new Note(); NoteToService noteToService = new NoteToService(); if (Request["note"] != null) { newNote.note1 = Request["note"]; db.Notes.Add(newNote); db.SaveChanges(); noteToService.date = DateTime.Now; noteToService.Note_idNote = db.Entry(newNote).Entity.idNote; noteToService.Service_idService = (int)id; noteToService.AspNetUser_idAspNetUser = db.AspNetUsers.Where(userName => userName.UserName == User.Identity.Name).First().Id; db.NoteToServices.Add(noteToService); db.SaveChanges(); } return(RedirectToAction("OrderDetails", new { id = id })); }