// GET: DRequest/Create public ActionResult Create() { ViewBag.WellID = new SelectList(db.Wells, "WellID", "WellName"); Survey s = new Survey(); s.RequestDate = DateTime.Now; s.ApprovedDate = DateTime.Now; s.SubmitDate = DateTime.Now; s.Status = "Waiting For Approval"; s.Progress= "Waiting For Submission"; return View(s); }
public ActionResult Edit([Bind(Include = "SurveyID,WellID,SurveyDesc,Type,Team,RequestBy,RequestDate,Comment,Status,Progress,ApprovedBy,ApprovedDate,SubmitBy,SubmitDate,PICName,FileData")] Survey survey, HttpPostedFileBase upload) { if (ModelState.IsValid) { if (upload != null && upload.ContentLength > 0) { var file = new Survey(); using (var reader = new BinaryReader(upload.InputStream)) { file.FileData = reader.ReadBytes(upload.ContentLength); } } db.Entry(survey).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.WellID = new SelectList(db.Wells, "WellID", "WellName", survey.WellID); survey.SubmitDate = DateTime.Now; return View(survey); }
public ActionResult Edit([Bind(Include = "SurveyID,WellID,SurveyDesc,Type,Team,RequestBy,RequestDate,Comment,Status,Progress,ApprovedBy,ApprovedDate,SubmitBy,SubmitDate,PICName,FileData")] Survey survey, string Command) { if (ModelState.IsValid) { db.Entry(survey).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } Survey s = new Survey(); ViewBag.WellID = new SelectList(db.Wells, "WellID", "WellName", survey.WellID); SelectList list = new SelectList("Approved", "Rejected"); ViewBag.SetStatus = list; survey.ApprovedDate = DateTime.Now; survey.SubmitDate = DateTime.Now; survey.Progress = "Waiting"; return View(survey); }