public async Task <IActionResult> Edit(int id, [Bind("ID,Patients_id,Status,Date")] Covid_status covid_status) { if (id != covid_status.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(covid_status); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Covid_statusExists(covid_status.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(covid_status)); }
public async Task <IActionResult> Create([Bind("ID,Patients_id,Status,Date")] Covid_status covid_status) { if (ModelState.IsValid) { _context.Add(covid_status); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(covid_status)); }
public async Task <IActionResult> Edit(int?id, [Bind("ID,Patients_id,Status,Date")] Covid_status covid_status) { if (id != covid_status.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(covid_status); await _context.SaveChangesAsync(); var result = _context.Patients.Where(i => i.ID == id).FirstOrDefault(); String status1 = status(int.Parse(covid_status.Status)); //var Phone = from p in _context.Patients.Local // where p.ID == id // select p.Phone_number; //var query = from p in _context.Patients // where p.ID == id // select p; // This will raise an exception if entity not found // Use SingleOrDefault instead //var professor = query.Single(); String phone = "+254713045562"; String message = "Greetings from Kericho County Hospital,You are informed the results for your covid 19 test is: " + status1 + ". Further information will be communicated to you."; SendMessage(phone, message, "ACcf10cfe7c3984d1961e961c7f2531f72", "01e49c30ddec944c6f665a4d46e5b7b9"); } catch (DbUpdateConcurrencyException) { if (!Covid_statusExists(covid_status.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(covid_status)); }
// GET: Covid_status/Create public IActionResult Create(int p_id, Covid_status Cs) { string selectedValue = Cs.Status; List <Status> DepartList = new List <Models.Status>(); DepartList = (from product in _context.Status select product).ToList(); //idList.Insert(0, new Rental_Owners { National_id=0,Full_names}) DepartList.Insert(0, new Status { ID = 0, C_status = "--Select status--" }); ViewBag.IDlist = DepartList; ViewBag.Role = "1"; ViewData["p_id"] = p_id; return(View()); }