public int Edit(Empresa_put entity) { Error myError = new Error(); int numeroContacto; try { var query = "Drilo_Cliente_PUTEmpresa"; DynamicParameters p = new DynamicParameters(); p.Add(name: "@clienteNumero", value: entity.clienteNumero); p.Add(name: "@clienteRut", value: entity.clienteRut); p.Add(name: "@ciudadCodigo", value: entity.ciudadCodigo); p.Add(name: "@clienteNomRazonSocial", value: entity.clienteNomRazonSocial); p.Add(name: "@clienteGiro", value: entity.clienteGiro); p.Add(name: "@clienteDirComercial", value: entity.clienteDirComercial); p.Add(name: "@clienteCodPostal", value: entity.clienteCodPostal); p.Add(name: "@clienteTelefono", value: entity.clienteNumero); p.Add(name: "@clienteMail", value: entity.clienteMail); p.Add(name: "@clienteWww", value: entity.clienteWww); p.Add(name: "@comunaCodigo", value: entity.comunaCodigo); p.Add(name: "@clienteRepresentante", value: entity.clienteRepresentante); p.Add(name: "@DescError", dbType: DbType.String, direction: ParameterDirection.Output, size: 1000); p.Add(name: "@NumError", dbType: DbType.Int32, direction: ParameterDirection.ReturnValue); numeroContacto = _cnx.Execute(sql: query, param: p, commandType: CommandType.StoredProcedure); myError.ErrorCode = p.Get <int>(name: "@NumError"); myError.ErrorMessage = p.Get <string>(name: "@DescError"); return(myError.ErrorCode > 0 ? throw new CustomException(message: myError.ErrorMessage, localError: myError) : numeroContacto); } catch (Exception e) { throw new Exception(message: "Error actualizando Empresa: " + e.Message); } }
public ResultModel ActualizarEmpresa(Empresa_put value, string token) { ResultModel resultModel = CheckToken(token); try { _empresaRepository.Edit(value); } catch (Exception e) { resultModel.ErrorMessage = e.Message; resultModel.ErrorCode = 10; resultModel.Payload = String.Empty; resultModel.Result = false; resultModel.Token = String.Empty; } return(resultModel); }
public ResultModel PutEmpresa([FromBody] Empresa_put value, [FromUri] string token) { EmpresaManager empresaManager = new EmpresaManager(); return(empresaManager.ActualizarEmpresa(value, token)); }