Beispiel #1
0
        public async Task <IHttpActionResult> GetStoreBookmark(int id)
        {
            StoreBookmark beautyShopBookmark = await db.BeautyShopBookmarks.FindAsync(id);

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

            return(Ok(beautyShopBookmark));
        }
Beispiel #2
0
        public async Task <IHttpActionResult> PutStoreBookmark(int id, StoreBookmark shopBookmark)
        {
            PetterResultType <StoreBookmark> petterResultType    = new PetterResultType <StoreBookmark>();
            List <StoreBookmark>             beautyShopBookmarks = new List <StoreBookmark>();

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            StoreBookmark beautyShopBookmark = await db.BeautyShopBookmarks.FindAsync(id);

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

            // 수정권한 체크
            if (beautyShopBookmark.MemberNo != shopBookmark.MemberNo)
            {
                return(BadRequest(ModelState));
            }

            //beautyShopBookmark.Reply = boardReply.Reply;
            //beautyShopBookmark.StateFlag = StateFlags.Use;
            beautyShopBookmark.DateModified    = DateTime.Now;
            db.Entry(beautyShopBookmark).State = EntityState.Modified;
            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            beautyShopBookmarks.Add(beautyShopBookmark);

            petterResultType.IsSuccessful = true;
            petterResultType.JsonDataSet  = beautyShopBookmarks;

            return(Ok(petterResultType));
        }
Beispiel #3
0
        public async Task <IHttpActionResult> DeleteStoreBookmark(int id)
        {
            PetterResultType <StoreBookmark> petterResultType    = new PetterResultType <StoreBookmark>();
            List <StoreBookmark>             beautyShopBookmarks = new List <StoreBookmark>();
            StoreBookmark beautyShopBookmark = await db.BeautyShopBookmarks.FindAsync(id);

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

            db.BeautyShopBookmarks.Remove(beautyShopBookmark);
            await db.SaveChangesAsync();

            beautyShopBookmarks.Add(beautyShopBookmark);

            petterResultType.IsSuccessful = true;
            petterResultType.JsonDataSet  = beautyShopBookmarks;

            return(Ok(petterResultType));
        }
Beispiel #4
0
        public async Task <IHttpActionResult> PostStoreBookmark(StoreBookmark beautyShopBookmark)
        {
            PetterResultType <StoreBookmark> petterResultType    = new PetterResultType <StoreBookmark>();
            List <StoreBookmark>             beautyShopBookmarks = new List <StoreBookmark>();

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            beautyShopBookmark.DateCreated  = DateTime.Now;
            beautyShopBookmark.DateModified = DateTime.Now;

            db.BeautyShopBookmarks.Add(beautyShopBookmark);
            await db.SaveChangesAsync();

            beautyShopBookmarks.Add(beautyShopBookmark);
            petterResultType.IsSuccessful = true;
            petterResultType.JsonDataSet  = beautyShopBookmarks;

            return(Ok(petterResultType));
        }