public IActionResult Put(string id, [FromBody] CustomerContactInfoPutDTO modifiedCustomer)
        {
            Customer dataBaseCustomer = new CustomerSC().GetCustomerById(id);

            if (dataBaseCustomer == null)
            {
                return(NotFound());
            }

            try
            {
                //TODO: Check if it is possible to pass the dataBaseCustomer insted of the id.
                new CustomerSC().UpdateCustomer(id, modifiedCustomer);
            }
            catch (Exception ex) when(ExceptionTypes.IsSqlException(ex))
            {
                string message = SqlExceptionMessages.GetCustomSqlExceptionMessage(ex.InnerException as SqlException);

                if (message != null)
                {
                    return(Conflict(message));
                }

                throw;
            }

            return(NoContent());
        }
Exemple #2
0
        public IActionResult Put(string id, [FromBody] CustomerContactInfoPutDTO modifiedCustomer)
        {
            // Se actualiza un registro.
            new CustomerSC().UpdateCustomer(id, modifiedCustomer);

            return(NoContent());
        }