public IEnumerable <FacVentas> InsertarFac(FacVentas ObjUser) { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConCC"].ToString()); try { using (IDbConnection db = conn) { var p = new DynamicParameters(); p.Add("@tipDocumento", ObjUser.tipDocumento, dbType: DbType.Int16, direction: ParameterDirection.Input); p.Add("@NumDocumento", ObjUser.NumDocumento, dbType: DbType.String, direction: ParameterDirection.Input); p.Add("@Nombres", ObjUser.Nombres, dbType: DbType.String, direction: ParameterDirection.Input); p.Add("@Apellidos", ObjUser.Apellidos, dbType: DbType.String, direction: ParameterDirection.Input); p.Add("@fchNacimiento", ObjUser.fchNacimiento, dbType: DbType.Date, direction: ParameterDirection.Input); p.Add("@Direccion", ObjUser.Direccion, dbType: DbType.String, direction: ParameterDirection.Input); p.Add("@Telefono", ObjUser.Telefono, dbType: DbType.String, direction: ParameterDirection.Input); p.Add("@ProductoId", ObjUser.ProductoId, dbType: DbType.Int16, direction: ParameterDirection.Input); p.Add("@Cantidad", ObjUser.Cantidad, dbType: DbType.Int16, direction: ParameterDirection.Input); p.Add("@ValUnitario", ObjUser.ValUnitario, dbType: DbType.Int32, direction: ParameterDirection.Input); return(db.Query <FacVentas>("spGrabarVentaCab", p, commandType: CommandType.StoredProcedure).AsList()); } } catch (Exception ex) { throw ex; } }
public IHttpActionResult InsertaFactura(FacVentas usr) { try { var resp = new _01_Dal.Dal.Metodos().InsertarFac(usr); return(Ok(resp)); } catch (Exception ex) { return(InternalServerError(ex)); } }