Beispiel #1
0
        public ActionResult checkData(SIGNIN data)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var user = db.Users
                               .Where(x => x.Name == data.Name && x.Password == data.Password && x.Email == data.Email)
                               .FirstOrDefault <User>();
                    if (user != null)
                    {
                        userloggedin.ID          = user.ID;
                        userloggedin.Name        = user.Name;
                        userloggedin.Password    = user.Password;
                        userloggedin.phoneNumber = user.PhoneNumber;
                        userloggedin.Email       = user.Email;

                        return(RedirectToAction("Index", "Home"));
                    }
                    else
                    {
                        data.founded = false;
                    }
                }
                catch
                {
                    data.founded = false;
                    return(View("SginIn", data));
                }
            }
            return(View("SginIn", data));
        }
Beispiel #2
0
        public ActionResult Index()
        {
            SIGNIN userIN = new SIGNIN();

            userIN.Name     = userloggedin.Name;
            userIN.Password = userloggedin.Password;
            return(View(userIN));
        }
Beispiel #3
0
        public ActionResult cloSearch()
        {
            var result1 = db.Clothes
                          .Where(s => s.name.Contains(txt) || s.Brand.Contains(txt));

            ViewBag.Message = result1;

            SIGNIN userIN = new SIGNIN();

            userIN.Name     = userloggedin.Name;
            userIN.Password = userloggedin.Password;
            //ViewBag.Title = SString.SearchString;
            return(View(userIN));
        }
Beispiel #4
0
        public ActionResult Search(string textbox)
        {
            if (textbox != null)
            {
                var result1 = db.Clothes
                              .Where(s => s.name.Contains(textbox) || s.Brand.Contains(textbox));

                var result2 = db.Labtobs
                              .Where(s => s.Details.Contains(textbox) || s.model.Contains(textbox) || s.Brand.Contains(textbox));

                var result3 = db.Phones
                              .Where(s => s.Details.Contains(textbox) || s.model.Contains(textbox) || s.Brand.Contains(textbox));

                var result4 = db.Accessories
                              .Where(s => s.Details.Contains(textbox) || s.model.Contains(textbox) || s.Brand.Contains(textbox));

                if (result1.Count() >= result2.Count() && result1.Count() >= result3.Count() && result1.Count() >= result4.Count())
                {
                    txt = textbox;
                    return(RedirectToAction("cloSearch", "Home"));
                }
                if (result2.Count() >= result1.Count() && result2.Count() >= result3.Count() && result2.Count() >= result4.Count())
                {
                    ViewBag.Message = result2;
                }
                if (result3.Count() >= result2.Count() && result3.Count() >= result1.Count() && result3.Count() >= result4.Count())
                {
                    ViewBag.Message = result3;
                }
                if (result4.Count() >= result2.Count() && result4.Count() >= result3.Count() && result4.Count() >= result1.Count())
                {
                    ViewBag.Message = result4;
                }
                SIGNIN userIN = new SIGNIN();
                userIN.Name     = userloggedin.Name;
                userIN.Password = userloggedin.Password;
                //ViewBag.Title = SString.SearchString;
                return(View(userIN));
            }
            return(RedirectToAction("Index", textbox));
        }