// POST api/<controller> public void Post(ReflectionDTO reflection) { try { InternReflection newReflection = new InternReflection() { VersID = reflection.VersID, NumHrs = reflection.NumHours }; db.InternReflections.Add(newReflection); db.SaveChanges(); } catch { throw new HttpResponseException(HttpStatusCode.BadRequest); } }
// PUT api/<controller>/5 public void Put(ReflectionDTO reflection) { try { InternReflection reflectionToUpdate = db.InternReflections.Find(reflection.VersID); reflectionToUpdate.NumHrs = reflection.NumHours; db.SaveChanges(); } catch { Post(reflection); } }