public ItemValor Add(ItemValor entity) { _contexto.Entry(entity.Orcamento).State = EntityState.Unchanged; if (entity.SubValores != null) { foreach (var item in entity.SubValores) { _contexto.Entry(item).State = EntityState.Unchanged; } } return(_contexto.ItemValor.Add(entity)); }
public static ItemValor ItemValor() { var itemValor = new ItemValor() { ID = 1, Vencimento = new System.DateTime(2014, 01, 13) }; itemValor.SubValores = new List <ItemSubValor>(); itemValor.SubValores.Add(new ItemSubValor() { ID = 1, Valor = 100M, }); return(itemValor); }
public List <ItemValor> ObterTodos() { List <ItemValor> itens = new List <ItemValor>(); string[] linhas = File.ReadAllLines(PATH); foreach (var linha in linhas) { ItemValor i = new ItemValor(); string[] dados = linha.Split("="); i.Nome = dados[0]; i.Preco = double.Parse(dados[1]); itens.Add(i); } return(itens); }
// POST: Edit public HttpResponseMessage Put(ItemValor itemValor) { HttpResponseMessage response; try { _gerenciadorDeItemValor.Editar(itemValor); response = Request.CreateResponse(HttpStatusCode.OK, itemValor); } catch (Exception ex) { response = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex); } return(response); }
public static ItemValor NovoItemValor() { var itemValor = new ItemValor() { ID = 99, Vencimento = DateTime.Now, Orcamento = OrcamentoStub.Receita(), SubValores = ItemSubValorStub.ItemSubValores() }; itemValor.SubValores.Add(new ItemSubValor() { ID = 1, Valor = 123.45M, }); return(itemValor); }
public void Inicializa() { itemValor = ItemValorStub.NovoItemValor(); }
public void Excluir(ItemValor itemValor) { _itemValorService.Delete(itemValor); _itemValorService.Save(); }
public ItemValor Editar(ItemValor itemValor) { _itemValorService.Edit(itemValor); _itemValorService.Save(); return(itemValor); }
public bool Salvar(ItemValor itemValor) { _itemValorService.Add(itemValor); _itemValorService.Save(); return(true); }
public void Edit(ItemValor entity) { _itemValorRepository.Edit(entity); }
public ItemValor Delete(ItemValor entity) { return(_itemValorRepository.Delete(entity)); }
public ItemValor Add(ItemValor entity) { return(_itemValorRepository.Add(entity)); }
public void Edit(ItemValor entity) { _contexto.Entry(entity).State = System.Data.Entity.EntityState.Modified; }
public ItemValor Delete(ItemValor entity) { return(_contexto.ItemValor.Remove(entity)); }