public async Task <IActionResult> Edit(string id, [Bind("DistCode,DistName,DistNameDari,DistNamePashto,ProvCode")] Districts districts) { if (id != districts.DistCode) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Entry(districts).State = EntityState.Modified; _context.Entry(districts).Property("CreatedDate").IsModified = false; await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DistrictsExists(districts.DistCode)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["ProvCode"] = new SelectList(_context.Provinces, "ProvCode", "ProvName", districts.ProvCode); return(View(districts)); }
public async Task <IActionResult> Edit(string id, [Bind("ProvCode,Aghchocode,Aimscode,ProvName,ProveNameDari,ProveNamePashto")] Provinces provinces) { if (id != provinces.ProvCode) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Entry(provinces).State = EntityState.Modified; _context.Entry(provinces).Property("CreatedDate").IsModified = false; await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProvincesExists(provinces.ProvCode)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(provinces)); }
public async Task <IActionResult> Edit(Guid id, [Bind("HospitalId,GbvCaseId,RptCode,RegNo,ItrCode,PatientName,PatientFatherName,Age,Sex,Address,MaritalStatus,RefDate,RefTime,LastUpdate")] GbvCase gbvCase) { if (id != gbvCase.GbvCaseId) { return(NotFound()); } if (ModelState.IsValid) { var row = await _context.GbvCase .Include(g => g.Hospital).AsNoTracking() .SingleOrDefaultAsync(m => m.GbvCaseId == id && m.UserName.Equals(User.Identity.Name)); if (row == null) { return(NotFound()); } try { gbvCase.PatientName = _crypto.Encrypt(gbvCase.PatientName); gbvCase.PatientFatherName = _crypto.Encrypt(gbvCase.PatientFatherName); gbvCase.LastUpdate = DateTime.Now; gbvCase.IncCode = String.Format("{0}-{1}", gbvCase.HospitalId, gbvCase.RegNo); _context.Entry(gbvCase).State = EntityState.Modified; _context.Entry(gbvCase).Property("UserName").IsModified = false; _context.Entry(gbvCase).Property("InsertDate").IsModified = false; await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GbvCaseExists(gbvCase.GbvCaseId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } var facilities = _context.FacilityInfo.Where(m => m.User.Equals(User.Identity.Name)).ToList(); ViewData["HospitalId"] = new SelectList(facilities, "FacilityId", "FacilityName", gbvCase.HospitalId); return(View(gbvCase)); }
public async Task <IActionResult> Create([Bind("Id,Name")] Tenant item) { if (ModelState.IsValid) { _context.Attach(item); _context.Entry(item).State = EntityState.Added; await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(item)); }