public virtual ActionResult SaveCustomerDetail(CustomerDetailModel model) { if (!ModelState.IsValid) { return(JsonValidationError()); } //if (_sessionContext.CurrentUser.Email != model.Email) //{ // ModelState.AddModelError("Error", "You cannot save detail to this Email!"); // return JsonValidationError(); //} var customerModel = new CustomerModel { UserId = Guid.Parse(model.UserId), BirthDate = Sanitizer.GetSafeHtmlFragment(model.BirthDate), DayOfBirth = Sanitizer.GetSafeHtmlFragment(model.DayOfBirth), Email = Sanitizer.GetSafeHtmlFragment(model.Email), FirstName = Sanitizer.GetSafeHtmlFragment(model.FirstName), Gender = Sanitizer.GetSafeHtmlFragment(model.Gender), LastName = Sanitizer.GetSafeHtmlFragment(model.LastName), Mobile = Sanitizer.GetSafeHtmlFragment(model.Mobile), MonthOfBirth = Sanitizer.GetSafeHtmlFragment(model.MonthOfBirth), PostCode = Sanitizer.GetSafeHtmlFragment(model.PostCode), Telephone = Sanitizer.GetSafeHtmlFragment(model.Telephone), Title = Sanitizer.GetSafeHtmlFragment(model.Title), YearOfBirth = Sanitizer.GetSafeHtmlFragment(model.YearOfBirth), NewsLetterSubscribed = model.NewsLetterSubscribed, NotifyByEmail = model.NotifyByEmail, NotifyByPost = model.NotifyByPost, NotifyBySMS = model.NotifyBySMS, SourceProcess = SourceProcessType.SITE_MYACCOUNT.ToString(), CompanyId = model.CompanyId }; customerModel.DayOfBirth = "00"; customerModel.MonthOfBirth = "00"; customerModel.YearOfBirth = "00"; if (customerModel.BirthDate.Split('/').Length == 3) { customerModel.DayOfBirth = customerModel.BirthDate.Split('/')[0]; customerModel.MonthOfBirth = customerModel.BirthDate.Split('/')[1]; customerModel.YearOfBirth = customerModel.BirthDate.Split('/')[2]; } var result = _customerRepository.UpdateCustomerDetail(customerModel.UserId.ToString(), customerModel); return(JsonSuccess(result.Result, JsonRequestBehavior.AllowGet)); }