Exemplo n.º 1
0
        public List <Common.Models.Rating> DisplayAllReviewDetailsByCustomer(string emailId)
        {
            try
            {
                var dal        = new QuickKartRepository();
                var ratingList = dal.DisplayAllReviewDetailsByCustomer(emailId);
                Common.Models.Rating rating;
                var ratings = new List <Common.Models.Rating>();
                if (ratingList.Any())
                {
                    foreach (var rate in ratingList)
                    {
                        rating                = new Common.Models.Rating();
                        rating.EmailId        = rate.EmailId;
                        rating.ProductId      = rate.ProductId;
                        rating.ProductName    = rate.Product.ProductName;
                        rating.ReviewComments = rate.ReviewComments;
                        rating.ReviewRating   = rate.ReviewRating;

                        ratings.Add(rating);
                    }
                }
                return(ratings);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        public bool DeleteRating(Common.Models.Rating rating)
        {
            var status = false;

            try
            {
                var dal = new QuickKartRepository();
                status = dal.DeleteRating(rating.EmailId, rating.ProductId);
            }
            catch (Exception ex)
            {
                status = false;
            }
            return(status);
        }
Exemplo n.º 3
0
        public bool UpdateReviewComments(Common.Models.Rating rating)
        {
            bool status = false;

            try
            {
                var dal = new QuickKartRepository();
                status = dal.UpdateReviewComments(rating.EmailId, rating.ProductId, rating.ReviewComments);
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
Exemplo n.º 4
0
        public bool InsertRating(Common.Models.Rating rating)
        {
            bool status = false;

            try
            {
                var dal = new QuickKartRepository();
                status = dal.AddRatings(rating);
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
Exemplo n.º 5
0
        public bool DeleteRating(Common.Models.Rating rating)
        {
            var status = false;

            try
            {
                CustomerBL customerBLObj = new CustomerBL();
                status = customerBLObj.DeleteRating(rating);
            }
            catch (Exception ex)
            {
                status = false;
            }
            return(status);
        }
Exemplo n.º 6
0
        public bool UpdateReviewComments(Common.Models.Rating rating)
        {
            bool status = false;

            try
            {
                CustomerBL customerBLObj = new CustomerBL();
                status = customerBLObj.UpdateReviewComments(rating);
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
Exemplo n.º 7
0
        public Common.Models.Rating GetProductReviewByCustomer(string emailId, string productId)
        {
            var rating = new Common.Models.Rating();

            try
            {
                CustomerBL customerBLObj = new CustomerBL();
                rating = customerBLObj.GetProductReviewByCustomer(emailId, productId);
            }
            catch (Exception ex)
            {
                rating = null;
            }
            return(rating);
        }
Exemplo n.º 8
0
        public bool InsertRating(Common.Models.Rating rating)
        {
            bool status = false;

            try
            {
                CustomerBL customerBLObj = new CustomerBL();
                status = customerBLObj.InsertRating(rating);
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
Exemplo n.º 9
0
        public Common.Models.Rating GetProductReviewByCustomer(string emailId, string productId)
        {
            var rating = new Common.Models.Rating();

            try
            {
                var dal  = new QuickKartRepository();
                var rate = dal.GetProductReviewByCustomer(emailId, productId);

                rating.EmailId        = rate.EmailId;
                rating.ProductId      = rate.ProductId;
                rating.ReviewRating   = rate.ReviewRating;
                rating.ReviewComments = rate.ReviewComments;
            }
            catch (Exception ex)
            {
                rating = null;
            }
            return(rating);
        }
Exemplo n.º 10
0
        public bool AddRatings(Common.Models.Rating rating)
        {
            bool status = false;

            try
            {
                Rating ratingObj = new Rating();
                ratingObj.EmailId        = rating.EmailId;
                ratingObj.ProductId      = rating.ProductId;
                ratingObj.ReviewComments = rating.ReviewComments;
                ratingObj.ReviewRating   = rating.ReviewRating;

                Context.Ratings.Add(ratingObj);
                Context.SaveChanges();
                status = true;
            }
            catch (Exception ex)
            {
                status = false;
            }
            return(status);
        }