Example #1
0
        public FeedbackModel AddNewFeedback(FeedbackModel feedbackModel)
        {
            Feedback feedback = new Feedback
            {
                PlayerId     = feedbackModel.player,
                FeedbackText = feedbackModel.text,
                FeedbackDate = DateTime.Now
            };

            DB.Feedbacks.Add(feedback);
            DB.SaveChanges();
            feedbackModel.id         = feedback.FeedbackId;
            feedbackModel.createDate = feedback.FeedbackDate;
            return(feedbackModel);
        }
 public HttpResponseMessage AddFeadback(FeedbackModel feedbackModel)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             string error = "{\"message\":\"Bad Request\" }";
             return(Request.CreateResponse(HttpStatusCode.BadRequest, error));
         }
         FeedbackModel fb = fbLogic.AddNewFeedback(feedbackModel);
         return(Request.CreateResponse(HttpStatusCode.Created, fb));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex));
     }
 }