예제 #1
0
        public override string Execute()
        {
            IList <string> parameters = TakeInput();

            var toBeRated = parameters[0].ToLower();
            var Id        = int.Parse(parameters[1]);
            var rating    = int.Parse(parameters[2]);
            var comment   = parameters[3];

            var feedback = factory.CreateFeedback();

            feedback.Rating  = rating;
            feedback.Comment = comment;

            if (toBeRated == "seller")
            {
                base.context.Sellers.Single(x => x.UserId == Id).Feedbacks.Add(feedback);
            }
            else if (toBeRated == "product")
            {
                base.context.Products.Single(x => x.Id == Id).Feedbacks.Add(feedback);
            }

            return($"Feedback added successfully");
        }