public async Task <IActionResult> Create([Bind("Category_ID,Category_Name,Category_Description,Category_Profile,Category_SubDescription,Category_MainProfile")] Category category, IFormFile fileobj, IFormFile fileobj1) { if (HttpContext.Session.GetString("SessionID") == null) { return(RedirectToAction("Create", "Login")); } var imgext = Path.GetExtension(fileobj.FileName); if (imgext == ".jpg" || imgext == ".png") { var uploadimg = Path.Combine("wwwroot", "Category_Image", fileobj.FileName); var stream = new FileStream(uploadimg, FileMode.Create); await fileobj.CopyToAsync(stream); stream.Close(); var uploadimg1 = Path.Combine("wwwroot", "Category_Image", fileobj1.FileName); var stream1 = new FileStream(uploadimg1, FileMode.Create); await fileobj1.CopyToAsync(stream1); stream1.Close(); //mi.Medicine_ID = 1; category.Category_Profile = fileobj.FileName; category.Category_MainProfile = fileobj1.FileName; await _context.CATEGORYTB.AddAsync(category); await _context.SaveChangesAsync(); } return(RedirectToAction("Index")); }
public async Task <ActionResult> Create([Bind(Include = "Id,FirstName,LastName,Age,Email,Password,Information,Location")] DoctorEntity doctorEntity) { if (ModelState.IsValid) { db.People.Add(doctorEntity); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(doctorEntity)); }
public async Task <IActionResult> Reg([Bind("Patient_ID,Patient_Name,Patient_Address,Patient_Contact,State_ID,City_ID,Patient_Email,Patient_Password,Patient_IsActive,Patient_Profile")] Patient patientReg, IFormCollection formCollection, IFormFile fileobj) { if (patientReg.State_ID == 0) { ModelState.AddModelError("", "Select State"); } else if (patientReg.City_ID == 0) { ModelState.AddModelError("", "Select City"); } var SubCategoryID = HttpContext.Request.Form["City_ID"].ToString(); 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" }); ViewBag.ListofCategory = statelist; var imgext = Path.GetExtension(fileobj.FileName); if (imgext == ".jpg" || imgext == ".png") { var uploadimg = Path.Combine("../Medical/wwwroot", "Patient_Image", fileobj.FileName); var stream = new FileStream(uploadimg, FileMode.Create); await fileobj.CopyToAsync(stream); stream.Close(); //mi.Medicine_ID = 1; patientReg.Patient_Profile = fileobj.FileName; patientReg.Patient_IsActive = true; var user = _context.PATIENTTB.SingleOrDefault( u => u.Patient_Email.Equals(patientReg.Patient_Email) ); if (user == null) { await _context.PATIENTTB.AddAsync(patientReg); await _context.SaveChangesAsync(); return(RedirectToAction("Login", "PatientReg")); } else { return(RedirectToAction("Fail")); } } return(View(patientReg)); }
public async Task <IActionResult> Create([Bind("Order_ID,Order_Status,Patient_ID,Payment_Type_ID,Order_Amount,Order_Date,Deliver_Date,Is_Paid")] Order order) { if (HttpContext.Session.GetString("SessionID") == null) { return(RedirectToAction("Create", "Login")); } if (ModelState.IsValid) { _context.Add(order); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(order)); }
public async Task <IActionResult> Create([Bind("State_ID,State_Name")] State state) { if (HttpContext.Session.GetString("SessionID") == null) { return(RedirectToAction("Create", "Login")); } if (ModelState.IsValid) { _context.Add(state); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(state)); }
public async Task <IActionResult> Create(IFormFile fileobj, [Bind("Career_ID,Patient_ID,Candidate_Name,Candidate_Contact,Candidate_Resume,Candidate_Email")] Career career) { if (HttpContext.Session.GetString("SessionID") == null) { return(RedirectToAction("Login", "PatientReg")); } var imgext = Path.GetExtension(fileobj.FileName); if (imgext == ".txt" || imgext == ".pdf") { var uploadimg = Path.Combine("../Medical/wwwroot", "Resume", fileobj.FileName); var stream = new FileStream(uploadimg, FileMode.Create); await fileobj.CopyToAsync(stream); stream.Close(); TempData["SessionID"] = HttpContext.Session.GetInt32("SessionID"); //TempData["SessionID"] = HttpContext.Session.GetString("SessionID"); //mi.Medicine_ID = 1; career.Patient_ID = (int)TempData["SessionID"]; career.Candidate_Resume = fileobj.FileName; await _context.CAREERTB.AddAsync(career); await _context.SaveChangesAsync(); } ViewBag.SID = TempData["Sessionid"]; TempData.Keep("SessionID"); return(RedirectToAction("Index", "Home2")); }
public async Task <IActionResult> BlockDoctor(int id) { var ord = await _context.DOCTORTB.FindAsync(id); ord.Doctor_ID = id; if (id != ord.Doctor_ID) { return(NotFound()); } ord.Doctor_IsActive = false; _context.DOCTORTB.Update(ord); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Doctor")); }
// GET: Patient/Delete/5 public async Task <IActionResult> BlockPatient(int id) { var ord = await _context.PATIENTTB.FindAsync(id); ord.Patient_ID = id; if (id != ord.Patient_ID) { return(NotFound()); } ord.Patient_IsActive = false; _context.PATIENTTB.Update(ord); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Patient")); }
public async Task <IActionResult> BlockClinic(int id) { var ord = await _context.CLINICTB.FindAsync(id); ord.Clinic_ID = id; if (id != ord.Clinic_ID) { return(NotFound()); } ord.Clinic_IsActive = false; _context.CLINICTB.Update(ord); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Clinic")); }
public async Task <IActionResult> Create([Bind("City_ID,State_ID,City_Name")] City city) { if (HttpContext.Session.GetString("SessionID") == null) { return(RedirectToAction("Create", "Login")); } if (ModelState.IsValid) { _context.Add(city); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["StateId"] = new SelectList(_context.STATETB, "State_ID", "State_Name"); return(View(city)); }
public async Task <IActionResult> CartDelete(int id) { var cartDel = await _context1.CARTTB.FindAsync(id); _context1.CARTTB.Remove(cartDel); await _context1.SaveChangesAsync(); // HttpContext.Session.Clear(); TempData.Keep("SessionID"); return(RedirectToAction("CartDisplay", "PatMedicine")); }
public async Task <IActionResult> Create(IFormFile fileobj, [Bind("Medicine_ID,Medicine_Name,Medicine_Price,Medicine_Brand,Medicine_Strip_Tablets,Medicine_Image,Medicine_Content,Medicine_Description")] Medicine mi) { var imgext = Path.GetExtension(fileobj.FileName); if (imgext == ".jpg" || imgext == ".png") { var uploadimg = Path.Combine("wwwroot", "Medicine_Main_Image", fileobj.FileName); var stream = new FileStream(uploadimg, FileMode.Create); await fileobj.CopyToAsync(stream); stream.Close(); //mi.Medicine_ID = 1; mi.Medicine_Image = fileobj.FileName; await _context.MEDICINETB.AddAsync(mi); await _context.SaveChangesAsync(); } return(RedirectToAction("Index")); }
public async Task <IActionResult> DeleteConfirmed(int id) { //if (HttpContext.Session.GetString("SessionID") == null) //{ // return RedirectToAction("Create", "Login"); //} var review = await _context.REVIEWTB.FindAsync(id); _context.REVIEWTB.Remove(review); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }