Ejemplo n.º 1
0
        public IActionResult PutStudent(Int64 key, [FromBody] Models.ConData.Student newItem)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnStudentUpdated(newItem);
                this.context.Students.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.Students.Where(i => i.StudentID == key);
                Request.QueryString = Request.QueryString.Add("$expand", "Gender,Country,Country1,Country2,Country3");
                this.OnAfterStudentUpdated(newItem);
                return(new ObjectResult(SingleResult.Create(itemToReturn)));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
Ejemplo n.º 2
0
 partial void OnStudentDeleted(Models.ConData.Student item);
Ejemplo n.º 3
0
 partial void OnAfterStudentUpdated(Models.ConData.Student item);
Ejemplo n.º 4
0
 partial void OnStudentCreated(Models.ConData.Student item);