Пример #1
0
        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));
        }
Пример #2
0
        public async Task <IHttpActionResult> GetStoreReviewStats(int id)
        {
            StoreReviewStats storeReviewStats = await db.StoreReviewStats.FindAsync(id);

            if (storeReviewStats == null)
            {
                return(NotFound());
            }

            return(Ok(storeReviewStats));
        }
Пример #3
0
        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));
        }
Пример #4
0
        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));
        }