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

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

                this.OnKundenStatusCreated(item);
                this.context.KundenStatuses.Add(item);
                this.context.SaveChanges();

                return(Created($"odata/DbSinDarEla/KundenStatuses/{item.KundenStatusID}", item));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
Exemplo n.º 2
0
        public IActionResult PutKundenStatus(int key, [FromBody] Models.DbSinDarEla.KundenStatus newItem)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnKundenStatusUpdated(newItem);
                this.context.KundenStatuses.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.KundenStatuses.Where(i => i.KundenStatusID == key);
                return(new ObjectResult(SingleResult.Create(itemToReturn)));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
Exemplo n.º 3
0
 partial void OnKundenStatusUpdated(Models.DbSinDarEla.KundenStatus item);