public async Task <IActionResult> PutKassaNomination(int id, KassaNomination kassaNomination) { if (id != kassaNomination.Id) { return(BadRequest()); } _context.Entry(kassaNomination).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!KassaNominationExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <KassaNomination> > PostKassaNomination(KassaNomination kassaNomination) { kassaNomination.Active = true; kassaNomination.DateAdded = DateTime.Now; kassaNomination.DateUpdated = DateTime.Now; kassaNomination.CreatedBy = 1; //TODO: swap 1 for UserId kassaNomination.UpdatedBy = 1; _context.KassaNomination.Add(kassaNomination); await _context.SaveChangesAsync(); return(CreatedAtAction("GetKassaNomination", new { id = kassaNomination.Id }, kassaNomination)); }