public IActionResult UpdateCustomer([FromBody] MvCustomerUpdate customerUpdate)
 {
     try
     {
         var updated = _customerService.UpdatePerson(customerUpdate);
         if (!updated)
         {
             return(BadRequest());
         }
         return(Ok());
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 2
0
        public bool UpdatePerson(MvCustomerUpdate customerUpdate)
        {
            using (var connection = _dah.GetConnection())
            {
                var jsonNew = JsonConvert.SerializeObject(customerUpdate);
                var command = connection.CreateCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "SpUpdateOrganizationTsk";
                command.Parameters.Add("@json", SqlDbType.NChar).Value = jsonNew;
                command.CommandTimeout = _comdTimeout;

                int rows = command.ExecuteNonQuery();

                if (rows > 0)
                {
                    return(true);
                }
                return(false);
            }
        }
Ejemplo n.º 3
0
        public bool UpdateCustomer(MvCustomerUpdate customer)
        {
            var jsonNew = JsonConvert.SerializeObject(customer);

            using (var conn = _dah.GetConnection())
            {
                using (var cmd = new SqlCommand("SpOrganizationUpdateTsk", conn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@Json", SqlDbType.NChar).Value = jsonNew;
                    cmd.CommandTimeout = int.Parse(_commandTimeout);
                    int rows = cmd.ExecuteNonQuery();
                    if (rows > 0)
                    {
                        return(true);
                    }
                    return(false);
                }
            }
        }
Ejemplo n.º 4
0
 public IActionResult UpdateCustomer([FromBody] MvCustomerUpdate customer)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest());
     }
     try
     {
         var updated = _customerService.UpdateCustomer(customer);
         if (!updated)
         {
             return(BadRequest());
         }
         return(Ok());
     }
     catch (Exception)
     {
         throw;
     }
 }