public async Task <IHttpActionResult> PostTechRequest(TechRequest techRequest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TechRequests.Add(techRequest); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (TechRequestExists(techRequest.RequestId)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = techRequest.RequestId }, techRequest)); }
public async Task <IHttpActionResult> GetTechRequest(int id) { TechRequest techRequest = await db.TechRequests.FindAsync(id); if (techRequest == null) { return(NotFound()); } return(Ok(techRequest)); }