public ActionResult DeleteConfirmed(int id) { SAILOR sailor = db.SAILORs.Find(id); db.SAILORs.Remove(sailor); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult AddNewPAtient(int id = 0) { SAILOR rand = db.SAILORs.Find(id); if (rand == null) { return(HttpNotFound()); } return(View(rand)); }
// // GET: /randsailor/Details/5 public ActionResult Details(int id = 0) { SAILOR sailor = db.SAILORs.Find(id); if (sailor == null) { return(HttpNotFound()); } return(View(sailor)); }
public ActionResult Edit(SAILOR sailor) { if (ModelState.IsValid) { db.Entry(sailor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sailor)); }
// GET: /Model/Result/5 public ActionResult Result(int RandID = 0) { SAILOR rand = db.SAILORs.Find(RandID); if (rand == null) { return(HttpNotFound()); } return(View(rand)); }
public ActionResult Create(SAILOR sailor) { if (ModelState.IsValid) { db.SAILORs.Add(sailor); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sailor)); }
public ActionResult Result([Bind(Include = "RandAllocation")] SAILOR rand) { if (ModelState.IsValid) { rand.RandDate = DateTime.UtcNow; db.Entry(rand).State = EntityState.Modified; db.SaveChanges(); //email.EmailAddress = "*****@*****.**"; //email.Name = "Mihaela"; //email.RandAllocation = rand.RandAllocation; //email.RandID = rand.RandID; //email.Send(); } return(View(rand)); }
public ActionResult AddNewPAtient ([Bind(Include = "RandID, ScreeningID, RandomisedBy,SiteID,SITE, ParticipantInitials, Age, Gender, Incl,Excl, ApproveMedical,ConsentDate, RandAllocation, RandMethod")] SAILOR rand) { if (ModelState.IsValid) { //Random Number rand.RandDate = DateTime.Today; rand.RandTime = DateTime.Now; // Test test=new Test(); rand.RandMethod = rand.RandMethod; // rand.SiteID = rand.SiteID; db.Entry(rand).State = EntityState.Modified; // db.SaveChanges(); try { // return db.SaveChanges(); db.SaveChanges(); } catch (DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } } return(RedirectToAction("Result", rand)); } return(View(rand)); }