예제 #1
0
        public object PatchAccount(int id, AccountInputPatchDto account)
        {
            SqlHelper sqlHelper = new SqlHelper(connectionString);

            List<SqlParameter> accountParameters = new List<SqlParameter>
            {
                new SqlParameter("id", id), new SqlParameter("description", account.Description)
            };

            var accountQuery = $@"UPDATE [account]
                                    SET [description] = @description
                                    WHERE [id] = @id";

            try
            {
                sqlHelper.VerifyConnection();

                sqlHelper.Update(accountQuery, CommandType.Text, accountParameters.ToArray());
            }
            catch (Exception ex)
            {
                sqlHelper.CloseConnection();

                Console.WriteLine($"Patch Account Exception: {ex}");
                return Utils.Wrap(false);
            }

            return Utils.Wrap(true);
        }
예제 #2
0
 public object PatchAccount(int id, AccountInputPatchDto account)
 {
     throw new System.NotImplementedException();
 }
 public object PatchAccount(int id, AccountInputPatchDto account)
 {
     return(!ModelState.IsValid || account == null
         ? BadRequest(ModelState)
         : controller.PatchAccount(id, account));
 }