public BaseResultType Validate(DefaultParamOfCRUDOperation <Core.Data.Domain.House> item) { BaseResultType baseResultType = new BaseResultType() { Status = ResultStatus.Success }; if (item.Item.CountOfEntrance == null) { //WarningQuestion question = new WarningQuestion() //{ // Id = "1", // Message = "Отсутствует количество подъездов" //}; //baseResultType.AddWarring(question); if (!item.IsSendAndAnswerQuestion("Отсутствует количество подъездов.Продолжить?", ResultQuestionType.NO, baseResultType)) { baseResultType.AddError(" Отмена"); } } if (item.Item.CountOfFloor == null) { WarningQuestion question = new WarningQuestion() { Id = "1", Message = "Отсутствует количество этажей" }; baseResultType.AddWarring(question); } return(baseResultType); }
public Task <BaseResultType <User> > LoginAllowCheckAsync(DefaultParamOfCRUDOperation <User> param) { return(Task.Run(() => { BaseResultType <User> resultType = new BaseResultType <User>(); if (param is null || param.Item is null) { resultType.AddError("Отсутствует параметр проверки пользователя."); }
/// <summary> /// Проверка возможности авторизации пользователя /// </summary> /// <param name="param"></param> /// <returns></returns> public Task <BaseResultType <User> > LoginAllowCheckAsync(DefaultParamOfCRUDOperation <UserDTO> param) { DefaultParamOfCRUDOperation <User> paramUser = new DefaultParamOfCRUDOperation <User>(); paramUser.Item = new User() { Email = param?.Item?.Email, Password = param?.Item?.Password }; return(_userFetchData.LoginAllowCheckAsync(paramUser)); }
// [ValidateAntiForgeryToken] public async Task <IActionResult> Login(DefaultParamOfCRUDOperation <UserDTO> param) { BaseResultType <User> result = await _accountService.LoginAllowCheckAsync(param); if (result.Status == ResultStatus.Success) { param.Item.Id = result.Data.Id; await Authenticate(param.Item); // аутентификация } return(Json(result)); }
// [DataRow("123l.ru", "pass", ResultStatus.Fail)] //TODO: Добавить проверку корректности почты public void LoginAsyncTest_CheckUser(string email, string password, ResultStatus resultCheck) { // ARRANGE RepositoryAddItem <User, AddParamOfCRUDOperation <User> > repositoryAddItem = new RepositoryAddItem <User, AddParamOfCRUDOperation <User> >(_uow, context); AccountService accountService = new AccountService(_uow, repositoryAddItem); DefaultParamOfCRUDOperation <UserDTO> userParam = new DefaultParamOfCRUDOperation <UserDTO>(); userParam.Item = new UserDTO(); userParam.Item.Email = email; userParam.Item.Password = password; // ACT BaseResultType result = accountService.LoginAllowCheckAsync(userParam).Result; //ASSERT Assert.IsTrue(result.Status == resultCheck); }
public BaseResultType Validate(DefaultParamOfCRUDOperation <ObjectMappingForTest> item) { BaseResultType baseResultType = new BaseResultType() { Status = ResultStatus.Success }; if (String.IsNullOrWhiteSpace(item.Item.StrValue)) { WarningQuestion question = new WarningQuestion() { Id = "1", Message = "Отсутствует строка" }; baseResultType.AddWarring(question); } return(baseResultType); }
public BaseResultType Validate(DefaultParamOfCRUDOperation <ObjectMappingForTest> item) { BaseResultType baseResultType = new BaseResultType() { Status = ResultStatus.Success }; if (String.IsNullOrWhiteSpace(item.Item.StrValue)) { if (!item.IsSendAndAnswerQuestion("Продолжить?", ResultQuestionType.NO, baseResultType)) { baseResultType.AddError("Ошибка"); } } if (item.Item.IntValue2 == 22) { baseResultType.AddWarring(new WarningQuestion() { Message = "Уведомления" }); } return(baseResultType); }
public BaseResultType Validate(DefaultParamOfCRUDOperation <ObjectMappingForTest> paramCRUDOperation) { return(new BaseResultType()); }