public IResult Update(Findeks findeks) { var newFindeks = CalculateFindeksScore(findeks).Data; _findeksDal.Update(newFindeks); return(new SuccessResult(Messages.FindeksUpdated)); }
public async Task <IResult> Update(Findeks findeks) { var newFindeks = CalculateFindeksScore(findeks).Data; await _findeksDal.UpdateAsync(newFindeks); return(new SuccessResult(Messages.FindeksUpdated)); }
public IResult Add(Findeks findeks) { var calculatedFindex = CalculateFindeksScore(findeks); _findeksDal.Add(calculatedFindex.Data); return(new SuccessResult(Messages.FindexAdded)); }
public IResult Add(Findeks findeks) { var newFindeks = CalculateFindeksScore(findeks).Data; _findeksDal.Add(newFindeks); return(new SuccessResult(Messages.Added)); }
public IDataResult <FindeksDto> GetUserFindeks(Findeks findeks) { var random = new Random(); return(new SuccessDataResult <FindeksDto>(new FindeksDto { FindeksScore = random.Next(1, 1900) })); }
public IActionResult Delete(Findeks findeks) { var result = _findexService.Delete(findeks); if (result.Success == true) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult GetFindeks([FromBody] Findeks findeks) { var result = _userService.GetUserFindeks(findeks); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult Update(Findeks findeks) { var result = _findeksService.Update(findeks); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult GetAll(Findeks findeks) { var result = _findeksService.GetAll(); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IDataResult <Findeks> GetUserFindeks(Findeks findeks) { Random rnd = new Random(); var userFindeks = new Findeks { Tc = findeks.Tc, DateYear = findeks.DateYear, UserFindeks = rnd.Next(0, 1900) }; return(new SuccessDataResult <Findeks>(userFindeks)); }
public IDataResult <Findeks> Add(Findeks findeks) { var nationalToCheck = GetFindeksByNationalId(findeks.NationalIdentity); if (nationalToCheck.Data == null) { Random value = new Random(); findeks.FindeksValue = (short)value.Next(0, 1901); _findeksDal.Add(findeks); return(new SuccessDataResult <Findeks>(findeks, Messages.FindexAdded)); } return(new ErrorDataResult <Findeks>(Messages.UserHasFindexAlreadyExist)); }
public IActionResult Add(Findeks findeks) { var result = _findeksService.Add(findeks); if (result.Success) { return(Ok(result)); } else { return(BadRequest(result.Message)); } }
public IResult UpdateUserDetails(UserDetailForUpdateDto userDetailForUpdate) { var user = GetById(userDetailForUpdate.Id).Data; if (!HashingHelper.VerifyPasswordHash(userDetailForUpdate.CurrentPassword, user.PasswordHash, user.PasswordSalt)) { return(new ErrorResult()); } user.FirstName = userDetailForUpdate.FirstName; user.LastName = userDetailForUpdate.LastName; if (!string.IsNullOrEmpty(userDetailForUpdate.NewPassword)) { byte[] passwordHash, passwordSalt; HashingHelper.CreatePasswordHash(userDetailForUpdate.NewPassword, out passwordHash, out passwordSalt); user.PasswordHash = passwordHash; user.PasswordSalt = passwordSalt; } _userDal.Update(user); var customer = _customerDal.Get(c => c.Id == userDetailForUpdate.CustomerId); customer.CompanyName = userDetailForUpdate.CompanyName; _customerDal.Update(customer); if (!string.IsNullOrEmpty(userDetailForUpdate.NationalIdentity)) { var findeks = _findeksService.GetByCustomerId(userDetailForUpdate.CustomerId).Data; if (findeks == null) { var newFindeks = new Findeks { CustomerId = userDetailForUpdate.CustomerId, NationalIdentity = userDetailForUpdate.NationalIdentity }; _findeksService.Add(newFindeks); } else { findeks.NationalIdentity = userDetailForUpdate.NationalIdentity; var newFindeks = _findeksService.CalculateFindeksScore(findeks).Data; _findeksDal.Update(newFindeks); } } return(new SuccessResult()); }
public IDataResult <int> CalculateFindeksRating() { Findeks findeks = new Findeks { CreditProductRepayments = new Random().Next(666), // 665 CurrentAccountsAndDebts = new Random().Next(666), // 665 LoanUsageIntensity = new Random().Next(191), // 190 NewLoansTaken = new Random().Next(210), // 209 OtherFactors = new Random().Next(172), // 171 // Equal to 1900 (1900 is max value of findeks rating) }; int creditProductRepayments = findeks.CreditProductRepayments; int currentAccountsAndDebts = findeks.CurrentAccountsAndDebts; int loanUsageIntensity = findeks.LoanUsageIntensity; int newLoansTaken = findeks.NewLoansTaken; int otherFactors = findeks.OtherFactors; int findeksRating = creditProductRepayments + currentAccountsAndDebts + loanUsageIntensity + newLoansTaken + otherFactors; findeks.MinimumFindeksRating = findeksRating; return(new SuccessDataResult <int>(findeksRating, Messages.FindeksRatingCalculated)); }
public IDataResult <Findeks> CalculateFindeksScore(Findeks findeks) { findeks.FindeksScore = new Random().Next(0, 1901); return(new SuccessDataResult <Findeks>(findeks)); }
public IResult Update(Findeks findeks) { _findeksDal.Update(findeks); return(new SuccessResult()); }
public IResult Delete(Findeks findeks) { _findeksDal.Delete(findeks); return(new SuccessResult()); }
public IResult Add(Findeks findeks) { _findeksDal.Add(findeks); return(new SuccessResult()); }
public IDataResult <Findeks> CalculateFindeksScore(Findeks findeks) // Fake { findeks.Score = (short)new Random().Next(0, 1901); return(new SuccessDataResult <Findeks>(findeks)); }
public IResult Update(Findeks findeks) { _findeksDal.Update(findeks); return(new SuccessResult(Messages.FindeksUpdated)); }
public IResult Add(Findeks findeks) { _findeksDal.Add(findeks); return(new SuccessResult(Messages.FindeksAdded)); }
public IResult Delete(Findeks findeks) { _findeksDal.Delete(findeks); return(new SuccessResult(Messages.DeletedFindex)); }
public async Task <IResult> Delete(Findeks findeks) { await _findeksDal.DeleteAsync(findeks); return(new SuccessResult(Messages.FindeksDeleted)); }