Ejemplo n.º 1
0
        public ActionResult AddFeedback(AddFeedbackDTO feedbackDTO)
        {
            if (!feedbackDTO.IsAnonymous)
            {
                feedbackDTO.CommentatorJmbg = HttpContext.User.FindFirst("Jmbg").Value;
            }

            return(RequestAdapter.SendRequestWithBody(_serviceSettings.FeedbackAndSurveyServiceUrl, "/api/feedback", feedbackDTO));
        }
Ejemplo n.º 2
0
        public void Add(AddFeedbackDTO feedback)
        {
            FeedbackMemento memento = new FeedbackMemento()
            {
                Comment            = feedback.Comment,
                IsAllowedToPublish = feedback.IsAllowedToPublish,
                IsPublished        = false,
                DateOfCreation     = DateTime.Now,
                Commentator        = GetCommentator(feedback.IsAnonymous, feedback.CommentatorJmbg)
            };

            _feedbackRepository.Add(new Feedback(memento));
        }
Ejemplo n.º 3
0
        public bool AddFeedback([FromBody] AddFeedbackDTO addFeedbackDTO)
        {
            var entities        = new FoodfeedbackDBContext();
            var FeedbackDetails = new Feedback()
            {
                SelectDate = addFeedbackDTO.SelectDate,
                TypeOfMeal = addFeedbackDTO.TypeOfMeal,
                Rating     = addFeedbackDTO.Rating,
                Comments   = addFeedbackDTO.Comments,
                Email      = addFeedbackDTO.Email
            };

            entities.Feedback.Add(FeedbackDetails);
            entities.SaveChanges();
            return(true);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// call the service and add feedback
 /// </summary>
 public IActionResult AddFoodFeedback([FromBody] AddFeedbackDTO addFeedbackDTO)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var result = _addFeedbackService.AddFeedback(addFeedbackDTO);
             if (result == true)
             {
                 return(Ok(result));
             }
         }
         catch (Exception)
         {
             return(StatusCode(500));
         }
     }
     return(BadRequest());
 }
 public IActionResult Add(AddFeedbackDTO feedback)
 {
     _service.Add(feedback);
     return(NoContent());
 }