// 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); } }
public void EditReflection(int versID, double numHrs) { InternReflection reflection = db.InternReflections.Find(versID); if (reflection == null) { reflection = new InternReflection() { NumHrs = numHrs, VersID = versID }; db.InternReflections.Add(reflection); } else reflection.NumHrs = numHrs; db.SaveChanges(); }