public async Task <IHttpActionResult> UpdateFESearchRequest(int id, FESearchRequest fESearchRequest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (id != fESearchRequest.ID)
            {
                return(BadRequest());
            }

            using (var db = new FEMainDBContext()) {
                db.Entry(fESearchRequest).State = EntityState.Modified;

                try {
                    await db.SaveChangesAsync();
                } catch (DbUpdateConcurrencyException) {
                    if (!FESearchRequestExists(id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
 public async Task <IHttpActionResult> PostFEExecution(FEExecution fEExecution)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     using (var db = new FEMainDBContext()) {
         db.FEExecutions.Add(fEExecution);
         await db.SaveChangesAsync();
     }
     return(CreatedAtRoute("DefaultApi", new { id = fEExecution.ID }, fEExecution));
 }