/// <summary> /// Updates the specified tag /// </summary> /// <returns> /// True if the tag was found and updated or false if the tag was not found /// </returns> public async Task <CommandResult> UpdateAsync(UpdateTagRequestModel model) { using (var connection = await this.sqlConnectionFactory.CreateConnectionAsync(true)) using (var transaction = connection.BeginTransaction()) { var userId = (int?)null; if (String.IsNullOrEmpty(model.UserName) == false) { var userDbResult = await this.database.InsertAccessPointUserIfNotExistsAsync(model.UserName, transaction); userId = userDbResult.Id; } var dbResult = await this.database.UpdateTagAsync( tagId : model.Id, userId : userId, isActive : model.IsActive, isDeleted : model.IsDeleted, accessLevel : model.AccessLevel, transaction : transaction ); transaction.Commit(); return(CommandResult.FromDbResult(dbResult)); } }
public async Task <IActionResult> UpdateTagAsync(UpdateTagRequestModel requestModel) { var command = this.commandFactory.CreateUpdateTagCommand(); var commandResult = await command.UpdateAsync(requestModel); if (commandResult.Success) { return(this.Ok()); } else { return(this.NotFound()); } }
public static async Task <HttpResponseMessage> UpdateTagAsync(UpdateTagRequestModel model, String authToken) { return(await PatchAsync($"/administration/api/tags/update", model, authToken)); }