public IActionResult Post([FromBody] KinShip item) { //caso nao grave if (ModelState.IsValid) { this.repository.Create(item); return(Ok(item)); } else { //ARRAY STRINGS ERROS var errors = new List <string>(); foreach (var state in ModelState) { foreach (var error in state.Value.Errors) { errors.Add(error.ErrorMessage); } } return(BadRequest(new { code = 401, message = errors })); } }
public void Update(KinShip ks) { dataContext.Entry(ks).State = EntityState.Modified; dataContext.SaveChanges(); }
public void Create(KinShip ks) { dataContext.Entry(ks).State = EntityState.Added; dataContext.SaveChanges(); }
public IActionResult Put([FromBody] KinShip item) { this.repository.Update(item); return(Ok(item)); }