public IActionResult Post([FromBody] Models.ConDb.Student item) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (item == null) { return(BadRequest()); } this.OnStudentCreated(item); this.context.Students.Add(item); this.context.SaveChanges(); var key = item.StudentID; var itemToReturn = this.context.Students.Where(i => i.StudentID == key); Request.QueryString = Request.QueryString.Add("$expand", "Gender,Class1"); return(new ObjectResult(SingleResult.Create(itemToReturn)) { StatusCode = 201 }); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(BadRequest(ModelState)); } }
partial void OnStudentUpdated(Models.ConDb.Student item);
partial void OnStudentDeleted(Models.ConDb.Student item);