Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            feedbackmaster feedbackmaster = db.feedbackmasters.Find(id);

            db.feedbackmasters.Remove(feedbackmaster);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "fid,fdesc,fdate,fitme,femailid")] feedbackmaster feedbackmaster)
 {
     if (ModelState.IsValid)
     {
         db.Entry(feedbackmaster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(feedbackmaster));
 }
Example #3
0
        public ActionResult Create([Bind(Include = "fid,fdesc,fdate,fitme,femailid")] feedbackmaster feedbackmaster)
        {
            if (ModelState.IsValid)
            {
                db.feedbackmasters.Add(feedbackmaster);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(feedbackmaster));
        }
Example #4
0
        public FeedbackDetailsModel AddFeedback(FeedbackModel model)
        {
            FeedbackDetailsModel data = null;

            using (nathus_rating_androidEntities context = new nathus_rating_androidEntities())
            {
                string         strPromoCode = GeneratePromoCode();
                feedbackmaster user         = new feedbackmaster();
                //user.FeedbackId = model.FeedbackId;
                user.CustomerId = model.CustomerId;
                user.Feedback   = model.Feedback;
                user.StoreId    = model.StoreId;
                context.feedbackmasters.Add(user);
                var result = context.SaveChanges();
                if (result > 0)
                {
                    if (model.CustomerType == "Registered")
                    {
                    }
                    else
                    {
                        promocodemaster p = new promocodemaster();
                        p.CustomerId = model.CustomerId;
                        p.PromoCode  = strPromoCode;
                        context.promocodemasters.Add(p);
                        context.SaveChanges();
                        //var promo = (from pro in context.promocodemasters
                        //             where pro.CustomerId == model.CustomerId
                        //             select pro.PromoCode).FirstOrDefault();
                        var customer = (from cust in context.loginmasters
                                        where cust.CustomerId == model.CustomerId
                                        select cust).FirstOrDefault();
                        SendSMS(customer.MobileNumber, strPromoCode);
                    }

                    var serv = (from s in context.loginmasters
                                join sl in context.feedbackmasters on s.CustomerId equals sl.CustomerId
                                where s.CustomerId == model.CustomerId
                                select new FeedbackDetailsModel()
                    {
                        CustomerId = s.CustomerId,
                        Feedback = (decimal)sl.Feedback,
                        FeedbackId = sl.FeedbackId,
                        StoreId = (int)sl.StoreId,
                        MobileNumber = s.MobileNumber,
                        CreatedOn = (DateTime)sl.CreatedOn
                    }).FirstOrDefault();
                    data = serv;
                }
            }
            return(data);
        }
Example #5
0
        // GET: showFeedback/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            feedbackmaster feedbackmaster = db.feedbackmasters.Find(id);

            if (feedbackmaster == null)
            {
                return(HttpNotFound());
            }
            return(View(feedbackmaster));
        }
Example #6
0
        public FeedbackModel AddFeedback(int customerid, int questionid, int anwserid)
        {
            FeedbackModel feedback = new FeedbackModel();

            using (evergreenfeedback_androidEntities context = new evergreenfeedback_androidEntities())
            {
                feedbackmaster u = new feedbackmaster();
                u.CustomerId = customerid;
                u.QuestionId = questionid;
                u.AnswerId   = anwserid;
                var cust = context.customermasters.Where(x => x.CustomerId == customerid).FirstOrDefault();
                if (cust.CustomerId > 0)
                {
                    var data = context.feedbackmasters.Where(x => x.CustomerId == u.CustomerId && x.QuestionId == u.QuestionId).FirstOrDefault();
                    if (data != null)
                    {
                        context.feedbackmasters.Where(x => x.CustomerId == u.CustomerId && x.QuestionId == u.QuestionId).ToList().ForEach(x => x.AnswerId = u.AnswerId);
                        //context.Entry(u).State = System.Data.Entity.EntityState.Modified;
                        //context.SaveChanges();
                        feedback.FeedbackId = data.FeedbackId;
                        feedback.CustomerId = (int)data.CustomerId;
                        feedback.QuestionId = (int)data.QuestionId;
                        feedback.AnswerId   = (int)data.AnswerId;
                        feedback.CreatedOn  = (DateTime)data.CreatedOn;
                    }
                    else
                    {
                        context.feedbackmasters.Add(u);
                    }
                    var result = context.SaveChanges();
                    if (result > 0)
                    {
                        var custdata = context.feedbackmasters.Where(x => x.CustomerId == u.CustomerId && x.QuestionId == u.QuestionId && x.AnswerId == anwserid).FirstOrDefault();
                        if (custdata != null)
                        {
                            feedback.FeedbackId = custdata.FeedbackId;
                            feedback.CustomerId = (int)custdata.CustomerId;
                            feedback.QuestionId = (int)custdata.QuestionId;
                            feedback.AnswerId   = (int)custdata.AnswerId;
                            feedback.CreatedOn  = (DateTime)custdata.CreatedOn;
                        }
                    }
                }
                return(feedback);
            }
        }
Example #7
0
        public IEnumerable <FeedbackDetailsModel> GetAllFeedback(FeedbackDetailsModel model)
        {
            IEnumerable <FeedbackDetailsModel> data = null;

            using (nathus_rating_androidEntities context = new nathus_rating_androidEntities())
            {
                feedbackmaster user = new feedbackmaster();
                var            serv = (from s in context.loginmasters
                                       join sl in context.feedbackmasters on s.CustomerId equals sl.CustomerId
                                       where s.CustomerId == model.CustomerId && s.StoreId == model.StoreId
                                       orderby sl.CreatedOn ascending
                                       select new FeedbackDetailsModel()
                {
                    CustomerId = s.CustomerId,
                    Feedback = (decimal)sl.Feedback,
                    FeedbackId = sl.FeedbackId,
                    StoreId = (int)sl.StoreId,
                    MobileNumber = s.MobileNumber,
                    CreatedOn = (DateTime)sl.CreatedOn
                }).ToList();
                data = serv;
            }
            return(data);
        }