// GET: Meet/Edit public ActionResult Edit(int id) { var service = CreateMeetService(); var detail = service.GetMeetByID(id); var model = new MeetEdit { MeetID = detail.MeetID, LocationOfMeet = detail.LocationOfMeet, DescriptionOfMeet = detail.DescriptionOfMeet, DateOfMeet = detail.DateOfMeet }; return(View(model)); }
public bool UpdateMeet(MeetEdit model) { using (var ctx = new ApplicationDbContext()) { var entity = ctx.Meets.Single (e => e.MeetID == model.MeetID); { entity.MeetID = model.MeetID; entity.LocationOfMeet = model.LocationOfMeet; entity.DescriptionOfMeet = model.DescriptionOfMeet; entity.DateOfMeet = model.DateOfMeet; return(ctx.SaveChanges() == 1); } } }
public IHttpActionResult Put(MeetEdit meet) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateMeetService(); if (!service.UpdateMeet(meet)) { return(InternalServerError()); } return(Ok()); }
public ActionResult Edit(int id, MeetEdit model) { if (!ModelState.IsValid) { return(View(model)); } if (model.MeetID != id) { ModelState.AddModelError("", "The ID's Do No Match"); return(View(model)); } var service = CreateMeetService(); if (service.UpdateMeet(model)) { TempData["SaveResult"] = "Your Meet Was Updated!"; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Nothing Was Changed, Please Enter Your Changes."); return(View(model)); }