Exemplo n.º 1
0
 public ActionResult Create([Bind(Include = "fid,PatientId,pname,Appointment,AppointmentTime,DOB,Gender,Status,cname")] FollowClass1 followClass1)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.FollowClass1s.Add(followClass1);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception e1) { ViewBag.err2 = e1.Message.ToString(); }
     return(View(followClass1));
 }
Exemplo n.º 2
0
        public ActionResult Edit([Bind(Include = "bid,PatientId,pname,Appointment,AppointmentTime,DOB,Gender,Prescription,Amount,Lab_Amount,Total_Amount,Vat,Net_Amount,Status,cname")] BillClass1 billClass1)
        {
            try
            {
                object o17 = billClass1.Status; string oo17 = o17.ToString();
                if (ModelState.IsValid)
                {
                    if (oo17 == "Bill_Inbox")
                    {
                        db.Entry(billClass1).State = EntityState.Modified;
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        FollowClass1 fc1 = new FollowClass1();
                        fc1.PatientId = billClass1.PatientId;
                        fc1.pname     = billClass1.pname;
                        //fc1.Appointment = "";
                        //fc1.AppointmentTime = "";
                        fc1.DOB    = billClass1.DOB;
                        fc1.Gender = billClass1.Gender;
                        fc1.cname  = billClass1.cname;

                        db2.FollowClass1s.Add(fc1);
                        db2.SaveChanges();              //data send to followsup


                        db.Entry(billClass1).State = EntityState.Modified;
                        db.SaveChanges();               // update to bills

                        //return RedirectToAction("Index");
                        return(Redirect("~/WebForm1.aspx?BillNo=" + billClass1.bid));
                    }
                }
            }
            catch (Exception e1) { ViewBag.err2 = e1.Message.ToString(); }
            return(View(billClass1));



            //if (ModelState.IsValid)
            //{
            //    db.Entry(billClass1).State = EntityState.Modified;
            //    db.SaveChanges();
            //    return RedirectToAction("Index");
            //}
            //return View(billClass1);
        }