コード例 #1
0
        public async Task <TEntity> AddAsync(TEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException($"{nameof(AddAsync)} entity must not be null");
            }

            try
            {
                await DoctorContext.AddAsync(entity);

                await DoctorContext.SaveChangesAsync();

                return(entity);
            }
            catch (Exception ex)
            {
                throw new Exception($"{nameof(entity)} could not be saved: {ex.Message}");
            }
        }
        public async Task <IActionResult> AppConfirm(int id, Appointment appointment)
        {
            var ord = await _context.APPOINTMENTTB.FindAsync(id);

            ord.Appointment_ID = id;

            if (id != ord.Appointment_ID)
            {
                return(NotFound());
            }
            ord.Appointment_Status = "Confirm";
            _context.APPOINTMENTTB.Update(ord);
            await _context.SaveChangesAsync();

            ViewBag.DoctorName = TempData["SessionName"];
            TempData.Keep("SessionName");
            ViewBag.DoctorImg = TempData["SessionImg"];
            TempData.Keep("SessionImg");
            ViewBag.SID = TempData["Sessionid"];
            TempData.Keep("Sessionid");
            return(RedirectToAction("Index", "DocAppointment"));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Doctor_ID,Doctor_Name,Doctor_Email,Doctor_Gender,Doctor_Password,Doctor_Contact,Doctor_IsActive,Category_ID,Doctor_Degree,Doctor_Profile,Doctor_Experience,Doctor_Education")] DoctorReg doctorReg, IFormCollection formCollection, IFormFile fileobj)
        {
            loadCategory();
            var imgext = Path.GetExtension(fileobj.FileName);

            if (imgext == ".jpg" || imgext == ".png")
            {
                var uploadimg = Path.Combine("../Medical/wwwroot", "Doctor_Image", fileobj.FileName);
                var stream    = new FileStream(uploadimg, FileMode.Create);

                await fileobj.CopyToAsync(stream);

                stream.Close();

                //mi.Medicine_ID = 1;
                doctorReg.Doctor_Profile  = fileobj.FileName;
                doctorReg.Doctor_IsActive = false;

                await _context.DOCTORTB.AddAsync(doctorReg);

                await _context.SaveChangesAsync();

                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("Login", "DoctorReg"));
            }



            return(View(doctorReg));
        }
コード例 #4
0
        public async Task <ActionResult <Doctor> > DeleteDoctor(int id)
        {
            var doctor = await _context.Doctors.FindAsync(id);

            if (doctor == null)
            {
                return(NotFound());
            }

            _context.Doctors.Remove(doctor);
            await _context.SaveChangesAsync();

            return(Ok());
        }
        public async Task <int> AddAsync(DoctorModel entity)
        {
            await DbContext.Set <DoctorModel>().AddAsync(entity);

            return(await DbContext.SaveChangesAsync());
        }
コード例 #6
0
        public async Task <IActionResult> Create(IFormFile fileobj, [Bind("Clinic_ID,Clinic_Name,Clinic_Address,Clinic_Pincode,Clinic_Contact,Clinic_IsActive,Clinic_Profile,State_ID,City_ID,Doctor_ID")] DocClinic clinic)
        {
            if (clinic.State_ID == 0)
            {
                ModelState.AddModelError("", "---Select State---");
            }
            else if (clinic.City_ID == 0)
            {
                ModelState.AddModelError("", "---Select City---");
            }


            // ------- Getting selected Value ------- //
            var SubCategoryID = HttpContext.Request.Form["City_ID"].ToString();


            // ------- Setting Data back to ViewBag after Posting Form ------- //
            List <State> statelist = new List <State>();

            statelist = (from state in _context.STATETB
                         select state).ToList();
            //statelist.Insert(0, new State { State_ID = 0, State_Name = "---Select State---" });
            //-------Assigning categorylist to ViewBag.ListofCategory------//
            ViewBag.ListofCategory = statelist;
            //return View(doctorReg);

            var imgext = Path.GetExtension(fileobj.FileName);

            if (imgext == ".jpg" || imgext == ".png")
            {
                var uploadimg = Path.Combine("../Medical/wwwroot", "Clinic_Images", fileobj.FileName);
                var stream    = new FileStream(uploadimg, FileMode.Create);

                await fileobj.CopyToAsync(stream);

                stream.Close();
                var d = HttpContext.Session.GetInt32("SessionID");
                clinic.Clinic_Profile  = fileobj.FileName;
                clinic.Clinic_IsActive = false;
                clinic.Doctor_ID       = (int)d;
                await _context.CLINICTB.AddAsync(clinic);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            //if (ModelState.IsValid)
            //{
            //    _context.Add(clinic);
            //    await _context.SaveChangesAsync();
            //    return RedirectToAction(nameof(Index));
            //}


            ViewBag.DoctorName = TempData["SessionName"];
            TempData.Keep("SessionName");
            ViewBag.DoctorImg = TempData["SessionImg"];
            TempData.Keep("SessionImg");
            ViewBag.SID = TempData["Sessionid"];
            TempData.Keep("Sessionid");
            return(View(clinic));
        }