Exemple #1
0
        public async Task <HttpResponseMessage> PostFeedback(int reasonID, string comment, int react, string fullname)
        {
            try
            {
                FeedbackDAL  dal  = new FeedbackDAL();
                JsonResponse data = await dal.PostFeedback(reasonID, comment, react, fullname);

                if (data != null && data.Flag)
                {
                    return(Request.CreateResponse <JsonResponse>(HttpStatusCode.OK, data));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Constants.ErrorNotFound));
                }
            }
            catch (DbEntityValidationException ex)
            {
                var    controllerName = ControllerContext.RouteData.Values["controller"].ToString();
                var    actionName     = ControllerContext.RouteData.Values["action"].ToString();
                Logger log            = new Logger();
                log.ErrorLog(ex, controllerName, actionName);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, Constants.ErrorSysError));
            }
        }