public async Task <Resident> GetUpdate(Resident obj, int?id) { // Flow will come here for Update obj = await _reRepo.GetAsync(SD.ResidentAPIPath, id.GetValueOrDefault(), HttpContext.Session.GetString("JWToken")); return(obj); }
public async Task <IActionResult> Get(int id) { var resident = await _residentRepository.GetAsync(id); var result = _mapper.Map <ResidentViewModel>(resident); return(Ok(result)); }
public async Task <ActionResult> UpsertResidentAccount(AccountViewModel avm) { avm.User.Role = avm.User.RolesEnum.ToString(); User user = new User() { Id = avm.User.Id, FirstName = avm.User.FirstName, LastName = avm.User.LastName, Username = avm.User.Username, Role = avm.User.RolesEnum.ToString() }; Resident resident = await _reRepo.GetAsync(SD.ResidentAPIPath, avm.User.ResidentId, HttpContext.Session.GetString("JWToken")); if (resident != null) { resident.PrimaryContact.Email = avm.User.Username; await _reRepo.UpdateAsync(SD.ResidentAPIPath + avm.User.ResidentId, resident, HttpContext.Session.GetString("JWToken")); } await _accRepo.UpdateAsync(SD.AccountAPIPath + user.Id, user, HttpContext.Session.GetString("JWToken")); return(RedirectToAction(nameof(Index))); }