public async Task <User> UpdateAsync(int id, User user) { this._logger.LogDebug("Starting UpdateAsync"); this._logger.LogDebug("Validating payload"); await _userValidator.ValidateAndThrowAsync(user); this._logger.LogDebug("Retriving the user the user wants to update"); var oldUser = await GetAsync(id); this._logger.LogDebug("Updating user"); await _sqlService.ExecuteAsync(UserQuery.UPDATE, new { Id = oldUser.UserId, IdProfile = user.Profile, IdCountry = user.Country, Name = user.Name, Birthdate = user.Birthdate, Active = user.Active }); user.UserId = oldUser.UserId; this._logger.LogDebug("Ending UpdateAsync"); return(user); }
public async Task DeleteAsync(int id) { this._logger.LogDebug("Starting DeleteAsync"); this._logger.LogDebug("Retriving the contact to delete it"); var contact = await GetAsync(id); this._logger.LogDebug("Deleting contact"); await _sqlService.ExecuteAsync(ContactQuery.DELETE, new { Id = contact.ContactId }); this._logger.LogDebug("Ending DeleteAsync"); }