public async Task<bool> InsertarCostoc(costo_tarifa costo) { using (var contexto = new ipwebec_hydrosEntities()) { contexto.costo_tarifa.Add(costo); int affected = await contexto.SaveChangesAsync(); return (affected == 1); } }
public async Task<bool> ModificarCosto(costo_tarifa costo) { using (var contexto = new ipwebec_hydrosEntities()) { var Ucosto = await contexto.costo_tarifa.FirstAsync(x => x.id == costo.id); Ucosto.nombre = costo.nombre; Ucosto.desde = costo.desde; Ucosto.es_base = costo.es_base; Ucosto.es_multa = costo.es_multa; Ucosto.hasta = costo.hasta; Ucosto.orden = costo.orden; Ucosto.tarifa_id = costo.tarifa_id; Ucosto.valor = costo.valor; int affected = await contexto.SaveChangesAsync(); return (affected == 1); } }