public async Task <IActionResult> Edit(int id, [Bind("Id,CentreName,CentreAddress,CentreAccountNo,DateCreated,Capital,CentreTabNumber,CentrePhone,CentrePOSNumber,UpdateDate,UpdateBy")] PayCentre payCentre) { if (id != payCentre.Id) { return(NotFound()); } if (ModelState.IsValid) { try { payCentre.UpdateDate = DateTime.Now.ToString(); _context.Update(payCentre); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PayCentreExists(payCentre.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(payCentre)); }
public async Task <ActionResult <PayCentre> > PostPayCentre(PayCentre payCentre) { _context.Centres.Add(payCentre); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPayCentre", new { id = payCentre.Id }, payCentre)); }
public async Task <IActionResult> PutPayCentre(int id, PayCentre payCentre) { if (id != payCentre.Id) { return(BadRequest()); } _context.Entry(payCentre).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PayCentreExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("Id,CentreName,CentreAddress,CentreAccountNo,DateCreated,Capital,CentreTabNumber,CentrePhone,CentrePOSNumber,UpdateDate,UpdateBy")] PayCentre payCentre) { if (ModelState.IsValid) { payCentre.UpdateDate = DateTime.Now.ToString(); _context.Add(payCentre); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(payCentre)); }