public IActionResult Post([FromBody] Models.DbSinDarEla.KundenKontakteArten item) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (item == null) { return(BadRequest()); } this.OnKundenKontakteArtenCreated(item); this.context.KundenKontakteArtens.Add(item); this.context.SaveChanges(); return(Created($"odata/DbSinDarEla/KundenKontakteArtens/{item.KundenKontaktArtID}", item)); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(BadRequest(ModelState)); } }
public IActionResult PutKundenKontakteArten(int key, [FromBody] Models.DbSinDarEla.KundenKontakteArten newItem) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (newItem == null || (newItem.KundenKontaktArtID != key)) { return(BadRequest()); } this.OnKundenKontakteArtenUpdated(newItem); this.context.KundenKontakteArtens.Update(newItem); this.context.SaveChanges(); var itemToReturn = this.context.KundenKontakteArtens.Where(i => i.KundenKontaktArtID == key); return(new ObjectResult(SingleResult.Create(itemToReturn))); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(BadRequest(ModelState)); } }
partial void OnKundenKontakteArtenUpdated(Models.DbSinDarEla.KundenKontakteArten item);