public bool Alterar(TipoPagamento tipoPagamento) { List <tf_tipo_pagamento> temp = db.tf_tipo_pagamento.Where(x => (x.id == tipoPagamento.id)).ToList(); if (temp.Count == 0) { return(false); } temp[0].id = tipoPagamento.id; temp[0].cobranca_juros = tipoPagamento.cobranca_juros; temp[0].is_ativo = tipoPagamento.is_ativo; temp[0].nome = tipoPagamento.nome; db.SaveChanges(); return(true); }
public void Add(TipoPagamento tipoPagamento) { if (tipoPagamento.cobranca_juros == null) { tipoPagamento.cobranca_juros = 0; } tf_tipo_pagamento temp = new tf_tipo_pagamento(); temp.cobranca_juros = (decimal)tipoPagamento.cobranca_juros; temp.id_instituicao = tipoPagamento.id_instituicao; temp.is_ativo = tipoPagamento.is_ativo; temp.nome = tipoPagamento.nome; db.tf_tipo_pagamento.Add(temp); db.SaveChanges(); }