Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            SAILOR sailor = db.SAILORs.Find(id);

            db.SAILORs.Remove(sailor);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public ActionResult AddNewPAtient(int id = 0)
        {
            SAILOR rand = db.SAILORs.Find(id);

            if (rand == null)
            {
                return(HttpNotFound());
            }
            return(View(rand));
        }
Esempio n. 3
0
        //
        // GET: /randsailor/Details/5

        public ActionResult Details(int id = 0)
        {
            SAILOR sailor = db.SAILORs.Find(id);

            if (sailor == null)
            {
                return(HttpNotFound());
            }
            return(View(sailor));
        }
Esempio n. 4
0
 public ActionResult Edit(SAILOR sailor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sailor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sailor));
 }
Esempio n. 5
0
        // GET: /Model/Result/5
        public ActionResult Result(int RandID = 0)
        {
            SAILOR rand = db.SAILORs.Find(RandID);

            if (rand == null)
            {
                return(HttpNotFound());
            }
            return(View(rand));
        }
Esempio n. 6
0
        public ActionResult Create(SAILOR sailor)
        {
            if (ModelState.IsValid)
            {
                db.SAILORs.Add(sailor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sailor));
        }
Esempio n. 7
0
        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));
        }
Esempio n. 8
0
        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));
        }