public async Task <ResponseMessage> SaveHomepass([FromBody] Homepass homepass) { try { if (homepass.Id == null) { homepass.CreatedBy = LoginUser.Name; homepass.CreatedDate = DateTime.UtcNow; } homepass.UpdatedBy = LoginUser.Name; homepass.UpdatedDate = DateTime.UtcNow; var savedHomepass = await _homepassService.SaveHomepass(homepass); if (savedHomepass == null) { return new ResponseMessage { Status = "Error", Message = "Error saving homepass." } } ; return(new ResponseMessage { Status = "Ok", Data = savedHomepass }); } catch (Exception ex) { _logger?.LogError(ex, "Error saving homepass."); return(new ResponseMessage { Status = "Error", Message = "Error saving homepass." }); } }
public async Task <ResponseMessage> SaveHomepass([FromBody] Homepass homepass) { try { //string loginUserId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; //var loginUser = await _userService.GetUserByLoginId(loginUserId); if (homepass.Id == null) { homepass.CreatedBy = LoginUser.Name; homepass.CreatedDate = DateTime.UtcNow; } homepass.UpdatedBy = LoginUser.Name; homepass.UpdatedDate = DateTime.UtcNow; var savedHomepass = await _homepassService.SaveHomepass(homepass); if (savedHomepass == null) { return new ResponseMessage { Status = "Error", Message = "Error saving homepass." } } ; return(new ResponseMessage { Status = "Ok", Data = savedHomepass }); } catch (Exception ex) { _logger?.LogError(ex, "Error saving homepass."); return(new ResponseMessage { Status = "Error", Message = "Error saving homepass." }); } }