public ActionResult SignUp(SignUp model) { if (ModelState.IsValid) { var Name = (from u in new GlassDatabaseEntities().GlassCustomerSignup where u.Mail == model.MMail select model.MMail).FirstOrDefault(); var Phone = (from u in new GlassDatabaseEntities().GlassCustomerSignup where u.PhoneNum == model.MMobileNumber select model.MMobileNumber).FirstOrDefault(); if (Name == model.MMail) { ViewBag.Mail = "Mail is already occupied"; ViewBag.list = StateList; return(View()); } else { if (Phone == model.MMobileNumber) { ViewBag.Mobile = "Mobile number is already occupied"; ViewBag.list = StateList; return(View()); } int id = repository.Addcustomer(model); if (id > 0) { ModelState.Clear(); return(RedirectToAction("Login")); } } } ViewBag.list = StateList; return(View()); }