public HttpResponseMessage Post(TermDTO term) { if (ModelState.IsValid) { _service.AddTerm(term); return Request.CreateResponse(HttpStatusCode.OK, term); } return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); }
public void AddTerm(TermDTO term) { Term newTerm = Mapper.Map<Term>(term); _repo.Add<Term>(newTerm); _repo.SaveChanges(); }