public void SaveImgCaption(int id, FormCollection form) { try { if (ModelState.IsValid) { //SAVE THE CAPTION FOR THE CORRECT IMAGE string caption = form["item.caption"].ToString(); int imgId = Convert.ToInt16(form["item.id"]); //GET THE IMAGE PROPERTIES FROM THE IMG ID image articleImage = db.images.Find(imgId); //MODIFY THE IMAGE CAPTION articleImage.caption = caption; db.Entry(articleImage).State = EntityState.Modified; db.SaveChanges(); } } catch (DbUpdateException e) { ViewBag.DbExceptionMessage = e.Message; } catch (SqlException e) { ViewBag.SqlExceptionMessage = e.Message; } catch (Exception e) { ViewBag.GenericException = e.Message; } RedirectToAction("Errors", "Navigate"); }
public void SaveImgCaption(int id, FormCollection form) { if (ModelState.IsValid) { //SAVE THE CAPTION FOR THE CORRECT IMAGE string caption = form["item.caption"].ToString(); int imgId = Convert.ToInt16(form["item.id"]); //GET THE IMAGE PROPERTIES FROM THE IMG ID image articleImage = db.images.Find(imgId); //MODIFY THE IMAGE CAPTION articleImage.caption = caption; db.Entry(articleImage).State = EntityState.Modified; db.SaveChanges(); } }
public ActionResult Edit([Bind(Include = "VolunteerID,FirstName,LastName,Dob,Phone,StAddress,Reason,skills,username,Email,dateavailable")] Volunteer volunteer) { if (ModelState.IsValid) { db.Entry(volunteer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(volunteer)); }
public async Task <ActionResult> Edit([Bind(Include = "GuideID,GuideName,GuideSpeciality,GuideSuitability")] TourGuide tourGuide) { if (ModelState.IsValid) { db.Entry(tourGuide).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(tourGuide)); }
public async Task <ActionResult> Edit([Bind(Include = "id,name,phone,address,city,province,postal_code")] site site) { if (ModelState.IsValid) { db.Entry(site).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(site)); }
public async Task <ActionResult> Edit([Bind(Include = "appointment_id,full_name,phone_number,appointment_date,detail")] appointment appointment) { if (ModelState.IsValid) { db.Entry(appointment).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(appointment)); }
public async Task <ActionResult> Edit([Bind(Include = "TourID,TourTime,TourName,GuideName")] Tour tour) { if (ModelState.IsValid) { db.Entry(tour).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(tour)); }
public async Task <ActionResult> Edit([Bind(Include = "feedback_id,user_id,date_location,suggestion,detail,problem")] feedback feedback) { if (ModelState.IsValid) { db.Entry(feedback).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(feedback)); }
public async Task <ActionResult> Edit([Bind(Include = "RequestID,TourID,UserID")] TourRequest tourRequest) { if (ModelState.IsValid) { db.Entry(tourRequest).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.TourID = new SelectList(db.Tours, "TourID", "TourTime", tourRequest.TourID); ViewBag.UserID = new SelectList(db.users, "id", "username", tourRequest.UserID); return(View(tourRequest)); }
public ActionResult PEdit(donation donation, FormCollection form) { try { if (ModelState.IsValid) { donation.north_shore_accounts.province_char = form["province_char"]; db.Entry(donation).State = EntityState.Modified; db.Entry(donation.north_shore_accounts).State = EntityState.Modified; db.Entry(donation.north_shore_accounts.payment_information).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } else { var errors = ModelState.Select(x => x.Value.Errors) .Where(y => y.Count > 0) .ToList(); ViewBag.province_char = new SelectList(db.provinces, "code", "name", donation.north_shore_accounts.province_char); return View("~/Views/donations/Edit.cshtml"); } } catch(DbUpdateException e) { ViewBag.GenericException = e.Message; } catch(SqlException e) { ViewBag.SqlExceptionMessage = e.Message; } catch (Exception e) { ViewBag.DbExceptionMessage = e.Message; } return View("~/Views/Navigate/Errors.cshtml"); }
public async Task <ActionResult> Edit([Bind(Include = "Id,TestName,CreatedDate")] AvailableTest availableTest) { if (Session["role"] != null && Session["role"].ToString() == "ADM") { if (ModelState.IsValid) { db.Entry(availableTest).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(availableTest)); } else { return(View("~/Views/LabTestResults/NotLoggedIn.cshtml")); } }
public async Task <ActionResult> Edit([Bind(Include = "Id,LabTestsConductedId,Result,CreatedDate")] LabTestResult labTestResult) { if (Session["role"] != null && Session["role"].ToString() == "ADM") { if (ModelState.IsValid) { db.Entry(labTestResult).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.LabTestsConductedId = new SelectList(db.LabTestsConducteds, "Id", "PatientName", labTestResult.LabTestsConductedId); return(View(labTestResult)); } else { return(View("~/Views/LabTestResults/NotLoggedIn.cshtml")); } }
public ActionResult Edit([Bind(Include = "id,question,answer,category_id")] faq faq) { try { if (Session["role"] != null) { if (Session["role"].ToString() == "ADM") { if (ModelState.IsValid) { int pub_id = Convert.ToInt16(Session["userId"]); faq.publisher_id = pub_id; faq.date_created = DateTime.Now; db.Entry(faq).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.category_id = new SelectList(db.categories, "id", "name", faq.category_id); return(View(faq)); } } else { return(View("~/Views/LabTestResults/NotLoggedIn.cshtml")); } } catch (DbUpdateException e) { ViewBag.DbExceptionMessage = e.Message; } catch (SqlException sqlException) { ViewBag.SqlExceptionMessage = sqlException.Message; } catch (Exception exception) { ViewBag.genericException = exception.Message; } return(View("~/Views/Errors/Details.cshtml")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,first_name,last_name,email_address,message_body,sent_date,reply_id")] message message) { try { if (ModelState.IsValid) { db.Entry(message).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.reply_id = new SelectList(db.messages, "Id", "first_name", message.reply_id); return(View(message)); } catch (Exception e) { ViewBag.GenericException = e.Message; } return(View("~/Views/Navigate/Errors.cshtml")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,PatientName,DoctorId,TestId,TestDate")] LabTestsConducted labTestsConducted) { if (Session["role"] != null && Session["role"].ToString() == "ADM") { if (ModelState.IsValid) { db.Entry(labTestsConducted).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.TestId = new SelectList(db.AvailableTests, "Id", "TestName", labTestsConducted.TestId); ViewBag.DoctorId = new SelectList(db.users, "id", "username", labTestsConducted.DoctorId); return(View(labTestsConducted)); } else { return(View("~/Views/LabTestResults/NotLoggedIn.cshtml")); } }
public async Task <ActionResult> Edit([Bind(Include = "dept_id,dept_name,dept_description,dept_extension,site_id")] department department) { try { if (Session["role"] != null) { if (Session["role"].ToString() == "ADM") { if (ModelState.IsValid) { db.Entry(department).State = EntityState.Modified; department.date_added = DateTime.Now; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.site_id = new SelectList(db.sites, "id", "name", department.site_id); return(View(department)); } } else { return(View("~/Views/LabTestResults/NotLoggedIn.cshtml")); } } catch (DbUpdateException e) { ViewBag.DbExceptionMessage = e.Message; } catch (SqlException sqlException) { ViewBag.SqlExceptionMessage = sqlException.Message; } catch (Exception exception) { ViewBag.genericException = exception.Message; } return(View("~/Views/Errors/Details.cshtml")); }