protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            string          Message = string.Empty;
            string          email   = (string)value;
            LoginRequest    request = new LoginRequest();
            ProcessResponse ps      = _userManagementService.EmailAvailableCheck(request);

            if (ps.StatusCode == 0)
            {
                Message = "Emailid not available";
                return(new ValidationResult(Message));
            }
            else
            {
                return(ValidationResult.Success);
            }
        }
        public ActionResult Register(CustomerSaveRequest request)
        {
            List <ServiceCategoriesResponse> serviceDrop  = new List <ServiceCategoriesResponse>();
            List <CategoryDropHomeResponse>  catDropsHome = new List <CategoryDropHomeResponse>();

            if (Session["CatDrop"] != null)
            {
                catDropsHome = (List <CategoryDropHomeResponse>)Session["CatDrop"];
            }
            if (Session["ServiceDrop"] != null)
            {
                serviceDrop = (List <ServiceCategoriesResponse>)Session["ServiceDrop"];
            }
            ViewBag.CatsDrop     = catDropsHome;
            ViewBag.ServiceDrop  = serviceDrop;
            ViewBag.ErrorMessage = "";
            List <USPGetCountriesListResponse> Countries = new List <USPGetCountriesListResponse>();

            Countries         = _categoryManagementService.GetCountries();
            ViewBag.CountryId = Countries;

            int?   CountryIdSelected = 0;
            int?   StateIdSelected   = 0;
            string CityIdSelected    = string.Empty;

            if (request.CountryId > 0)
            {
                CountryIdSelected = request.CountryId;
            }
            if (request.StateProvinceId > 0)
            {
                StateIdSelected = request.StateProvinceId;
            }
            if (!string.IsNullOrEmpty(request.City))
            {
                CityIdSelected = request.City;
            }

            if (ModelState.IsValid)
            {
                //check for emailavalable
                ProcessResponse ps = new ProcessResponse();
                LoginRequest    lr = new LoginRequest();
                lr.emailId = request.Email;
                ps         = _userManagementService.EmailAvailableCheck(lr);
                if (ps.StatusCode == 0)
                {
                    ModelState.AddModelError("Email", "Emailid not avaialble");
                }
            }
            if (ModelState.IsValid)
            {
                ProcessResponse pr = new ProcessResponse();
                pr = _userManagementService.RegisterUser(request);
                if (pr.CurrentId > 0)
                {
                    return(RedirectToAction("RegistrationSuccess", new { UserType = request.CustomerType, Id = pr.CurrentId }));
                }
                else
                {
                    ViewBag.ErrorMessage = "Unable to register now, please try later : " + pr.Message;
                    return(View(request));
                }
            }



            return(View(request));
        }