コード例 #1
0
        /// <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));
                }
        }
コード例 #2
0
        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());
            }
        }
コード例 #3
0
 public static async Task <HttpResponseMessage> UpdateTagAsync(UpdateTagRequestModel model, String authToken)
 {
     return(await PatchAsync($"/administration/api/tags/update", model, authToken));
 }