public HttpResponseMessage Get([FromUri] preg_weekly_interact data)
 {
     try
     {
         int user_id = Convert.ToInt32(((ClaimsIdentity)(User.Identity)).FindFirst("id").Value);
         if (!data.DeepEquals(new preg_weekly_interact()))
         {
             data.user_id = user_id;
             IQueryable <preg_weekly_interact> result = dao.GetItemsByParams(data);
             if (result.Any())
             {
                 return(Request.CreateResponse(HttpStatusCode.OK, result));
             }
             else
             {
                 HttpError err = new HttpError(SysConst.DATA_NOT_FOUND);
                 return(Request.CreateErrorResponse(HttpStatusCode.NotFound, err));
             }
         }
         else
         {
             IQueryable <preg_weekly_interact> result = dao.GetListItem().Where(c => c.user_id == user_id);
             if (result.Any())
             {
                 return(Request.CreateResponse(HttpStatusCode.OK, result));
             }
             else
             {
                 HttpError err = new HttpError(SysConst.DATA_NOT_FOUND);
                 return(Request.CreateErrorResponse(HttpStatusCode.NotFound, err));
             }
         }
     }
     catch (Exception ex)
     {
         HttpError err = new HttpError(ex.Message);
         return(Request.CreateErrorResponse(HttpStatusCode.NotFound, err));
     }
 }
        public HttpResponseMessage UpdateData(string week_id, int user_id, [FromBody] preg_weekly_interact dataUpdate)
        {
            try
            {
                if (!dataUpdate.DeepEquals(new preg_weekly_interact()))
                {
                    preg_weekly_interact weekly_interact = new preg_weekly_interact();
                    weekly_interact = dao.GetItemByID(Convert.ToInt32(week_id), user_id).FirstOrDefault();

                    if (weekly_interact == null)
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotFound, SysConst.DATA_NOT_FOUND));
                    }
                    if (dataUpdate.like != null)
                    {
                        weekly_interact.like = dataUpdate.like;
                    }
                    if (dataUpdate.comment != null)
                    {
                        weekly_interact.comment = dataUpdate.comment;
                        if (dataUpdate.comment.ToLower() == "null")
                        {
                            weekly_interact.comment = null;
                        }
                    }
                    if (dataUpdate.photo != null)
                    {
                        weekly_interact.photo = dataUpdate.photo;
                        if (dataUpdate.photo.ToLower() == "null")
                        {
                            weekly_interact.photo = null;
                        }
                    }
                    if (dataUpdate.share != null)
                    {
                        weekly_interact.share = dataUpdate.share;
                        if (dataUpdate.share.ToLower() == "null")
                        {
                            weekly_interact.share = null;
                        }
                    }
                    if (dataUpdate.notification != null)
                    {
                        weekly_interact.notification = dataUpdate.notification;
                    }
                    if (dataUpdate.status != null)
                    {
                        weekly_interact.status = dataUpdate.status;
                    }

                    dao.UpdateData(weekly_interact);
                    return(Request.CreateResponse(HttpStatusCode.Accepted, SysConst.DATA_UPDATE_SUCCESS));
                }
                else
                {
                    HttpError err = new HttpError(SysConst.DATA_NOT_EMPTY);
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, err));
                }
            }
            catch (Exception ex)
            {
                HttpError err = new HttpError(ex.Message);
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, err));
            }
        }