示例#1
0
        public ActionResult SliderCreate(HttpPostedFileBase imagefile)
        {
            if (imagefile != null && imagefile.ContentLength != 0)
            {
                string path      = Server.MapPath("~/Uploads/Sliders/");
                string largepath = path + "large/";
                string thumbpath = path + "thumb/";

                imagefile.SaveAs(largepath + imagefile.FileName);

                Image i     = Image.FromFile(largepath + imagefile.FileName);
                Size  s     = new Size(200, 50);
                Image small = Helper.ResizeImage(i, s);     //kçük resmi elde ettik
                small.Save(thumbpath + imagefile.FileName); //küçük resmi kaydettik
                                                            //klasörlere kaydettik şimdi veri tabanına kaydecez
                i.Dispose();                                //en son eklenen resm o an silinmek istediğinde hata verdiği için bu eklendi çöpe atıyor (arastr bunu)


                Slider slider = new Slider();
                //img src içinde göstereceğimiz için relative path kaydediyoruz
                slider.LargeImageUrl = "/Uploads/Sliders/large/" + imagefile.FileName;
                ////small kaydettik
                slider.ThumbnailUrl = "/Uploads/Sliders/thumb/" + imagefile.FileName;

                db.Sliders.Add(slider);
                db.SaveChanges();
                return(View());
            }


            return(View());
        }
示例#2
0
        public IActionResult Post([FromBody] Doctor obj)
        {
            var data = DocDetails.Doctor.Add(obj);

            DocDetails.SaveChanges();
            return(Ok());
        }
        public ActionResult AddDoctor(Doctor doctor)
        {
            //insert into table
            db.Doctors.Add(doctor);
            db.SaveChanges();

            return(RedirectToAction("IndexDoc"));
        }
示例#4
0
        public ActionResult EditDoctor(Doctor doctor)
        {
            db.Entry(doctor).State = EntityState.Modified;
            db.SaveChanges();

            return(RedirectToAction("Index", new { id = Session["userID"] }));
        }
示例#5
0
        public void QuitReferral(int DoctorId, Referral Referral)
        {
            Doctor TargetDoctor;

            using (var db2 = new DoctorContext())
            {
                TargetDoctor = db2.Doctors.Include("Referrals").First(x => x.Id.Equals(DoctorId));
                TargetDoctor.Referrals.Remove(Referral);
                db2.Entry(TargetDoctor).State = EntityState.Modified;
                db2.SaveChanges();
            }
        }
示例#6
0
 public bool Complete() //savechanges yapacağımız yer
 {                      //dosyalarla alakalı tüm işlemlerde / bool tipi döndüren metotlarda try catch kullanmamız gerekir! (garantiye almak için)
     try
     {
         db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
示例#7
0
        public ActionResult ChangePassword(int id, DoctorReg model)
        {
            var item = _context.DOCTORTB.Where(x => x.Doctor_ID == model.Doctor_ID).First();

            item.Doctor_Password = model.Doctor_Password;
            //_context.Update(model);
            _context.SaveChanges();

            ViewBag.DoctorName = TempData["SessionName"];
            TempData.Keep("SessionName");
            ViewBag.DoctorImg = TempData["SessionImg"];
            TempData.Keep("SessionImg");
            ViewBag.SID = TempData["Sessionid"];
            TempData.Keep("Sessionid");
            TempData.Keep("CountAppo");
            TempData.Keep("CountPat");
            TempData.Keep("CountReview");
            return(RedirectToAction("PasswordChangeMsg"));
        }
示例#8
0
        public void Edit(Doctor newData, int id)
        {
            Doctor Modified;

            using (var db = new DoctorContext())
            {
                Modified                = db.Doctors.Find(id);
                Modified.Active         = newData.Active;
                Modified.Name           = newData.Name;
                Modified.Middle_initial = newData.Middle_initial;
                Modified.Last_name      = newData.Last_name;
                Modified.Clinic_name    = newData.Clinic_name;
                Modified.Address        = newData.Address;
                Modified.Email          = newData.Email;
                Modified.Fax            = newData.Fax;
                Modified.Office_phone   = newData.Office_phone;
                Modified.DEA            = newData.DEA;
                Modified.NAGP           = newData.NAGP;
                Modified.NPI            = newData.NPI;
                Modified.Notes          = newData.Notes;
                db.SaveChanges();
            }
        }
 public IHttpActionResult PostDoctor(Doctor newDoctor)
 {
     db.DoctorList.Add(newDoctor);
     db.SaveChanges();
     return(Ok());
 }