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

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

                this.OnBaseCreated(item);
                this.context.Bases.Add(item);
                this.context.SaveChanges();

                var key = item.BaseID;

                var itemToReturn = this.context.Bases.Where(i => i.BaseID == key);

                Request.QueryString = Request.QueryString.Add("$expand", "BaseAnreden");

                return(new ObjectResult(SingleResult.Create(itemToReturn))
                {
                    StatusCode = 201
                });
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
Esempio n. 2
0
 partial void OnBaseDeleted(Models.DbSinDarEla.Base item);
Esempio n. 3
0
 partial void OnBaseCreated(Models.DbSinDarEla.Base item);