コード例 #1
0
        public BaseResponse <int> Like()
        {
            BaseResponse <int> response = null;

            try
            {
                string token = Request.Headers["Auth"];
                User   user  = businessLogicLayer.Check(token);

                int  foodId  = int.Parse(Request.Query["foodId"]);
                bool hasLike = bool.Parse(Request.Query["hasLike"]);
                businessLogicLayer.LikeForFood(user.Id, foodId, hasLike);
                response = new BaseResponse <int>(0);
            }
            catch (Exception ex)
            {
                response = new BaseResponse <int> {
                    Error = ex.Message
                };
            }
            return(response);
        }