public async Task <IHttpActionResult> PutStoreReviewStats(int id, StoreReviewStats storeReviewStats) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != storeReviewStats.StoreReviewStatsNo) { return(BadRequest()); } db.Entry(storeReviewStats).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StoreReviewStatsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetStoreReviewStats(int id) { StoreReviewStats storeReviewStats = await db.StoreReviewStats.FindAsync(id); if (storeReviewStats == null) { return(NotFound()); } return(Ok(storeReviewStats)); }
public async Task <IHttpActionResult> PostStoreReviewStats(StoreReviewStats storeReviewStats) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.StoreReviewStats.Add(storeReviewStats); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = storeReviewStats.StoreReviewStatsNo }, storeReviewStats)); }
public async Task <IHttpActionResult> DeleteStoreReviewStats(int id) { StoreReviewStats storeReviewStats = await db.StoreReviewStats.FindAsync(id); if (storeReviewStats == null) { return(NotFound()); } db.StoreReviewStats.Remove(storeReviewStats); await db.SaveChangesAsync(); return(Ok(storeReviewStats)); }