public IActionResult Post([FromBody] User value) { if (value == null) { return(BadRequest()); } value.Id = _db.Users.ToList().Count; _db.Users.Add(value); _db.SaveChanges(); return(Ok(_db.Users.FirstOrDefault(db => db.Id == value.Id))); }
public IActionResult Post([FromBody] Ticket value) { if (value == null) { return(BadRequest("problem is here")); } value.Id = _db.Tickets.ToList().Count; _db.Tickets.Add(value); _db.SaveChanges(); return(Ok()); }
public IActionResult Post([FromBody] Partner value) { if (value == null) { return(BadRequest()); } value.Id = _db.Partners.ToList().Count; var bank = new Bank(); bank.Id = _db.Banks.ToList().Count + 1; value.BankId = bank.Id; _db.Partners.Add(value); _db.SaveChanges(); return(Ok(value)); }