Beispiel #1
0
        public async Task<JsonResult> SignUp(UserViewModel userViewModel)
         {
            if (ModelState.IsValid && userViewModel!=null)
            {
                UserModel userModel = new UserModel();
                Mapper.Map(userViewModel, userModel);
                userModel.FirstName = userViewModel.FullName;                
                userModel.CompanyModel.Name= userViewModel.CompanyName;
                

                var response = await _authenticationService.CreateUser(userModel);

                if (response.Success == true)
                {
                   
                    //userModel.UserName = userModel.Email;
                    //userModel.Password = userModel.Password;
                    AuthenticationServiceResponse loginResponse = _authenticationService.SignInUser(userModel);
                }
                return Json(response, JsonRequestBehavior.AllowGet);
            }
            return Json(new {Message="ModelState IsVaid is False",Success=false}, JsonRequestBehavior.AllowGet);
        }
Beispiel #2
0
 //return Json(new { Success = true, Contacts = userViewModel, Message = "Successful" }, JsonRequestBehavior.AllowGet);
 public JsonResult GetContactById(string Id)
 {
     UserViewModel contactViewModel = new UserViewModel();
     UserModel contactModel = _accountService.GetContactById(Id.Decrypt());
     Mapper.Map(contactModel, contactViewModel);
     return Json(contactViewModel, JsonRequestBehavior.AllowGet);
 }
Beispiel #3
0
 public JsonResult AddEditContact(UserViewModel userViewModel)
 {
     var userModel = new UserModel();
     Mapper.Map(userViewModel, userModel);
     var result = _accountService.AddEditContact(userModel, userModel.AccountId);
     userModel = (UserModel)result.Data;
     Mapper.Map(userModel, userViewModel);
     result.Data = userViewModel;
     return Json(result, JsonRequestBehavior.AllowGet);
 }