Esempio n. 1
0
        public IActionResult Post([FromBody] Models.DbSinDarEla.KundenLeistungArten item)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                if (item == null)
                {
                    return(BadRequest());
                }

                this.OnKundenLeistungArtenCreated(item);
                this.context.KundenLeistungArtens.Add(item);
                this.context.SaveChanges();

                return(Created($"odata/DbSinDarEla/KundenLeistungArtens/{item.KundenLeistungArtID}", item));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
Esempio n. 2
0
        public IActionResult PutKundenLeistungArten(int key, [FromBody] Models.DbSinDarEla.KundenLeistungArten newItem)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                if (newItem == null || (newItem.KundenLeistungArtID != key))
                {
                    return(BadRequest());
                }

                this.OnKundenLeistungArtenUpdated(newItem);
                this.context.KundenLeistungArtens.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.KundenLeistungArtens.Where(i => i.KundenLeistungArtID == key);
                return(new ObjectResult(SingleResult.Create(itemToReturn)));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
Esempio n. 3
0
 partial void OnKundenLeistungArtenDeleted(Models.DbSinDarEla.KundenLeistungArten item);