public async Task <IActionResult> Edit(int id, [Bind("Id,EGN,dateDonated,Quantity,BloodGroupId,Receiver")] Donation donation) { if (id != donation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { var EGNcheck = _context.RCTHUsers.FirstOrDefault(u => u.EGN == donation.EGN); donation.UserId = EGNcheck == null ? null : EGNcheck.Id; _context.Update(donation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DonationExists(donation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BloodGroupId"] = new SelectList(_context.BloodGroups, "Id", "Name", donation.BloodGroupId); return(View(donation)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,DonationId,dateReleased,HIV,HepatitisB,HepatitisC,Syphilis,PCR,Doctor")] MedResult medResult) { if (id != medResult.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(medResult); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MedResultExists(medResult.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DonationId"] = new SelectList(_context.Donations, "Id", "EGN", medResult.DonationId); return(View(medResult)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Content,AuthorName,DateCreated")] Article article) { if (id != article.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(article); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArticleExists(article.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(article)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,EventTitle,Description,Date,Location")] Event @event) { if (id != @event.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(@event); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EventExists(@event.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(@event)); }