public IActionResult DarLance([Bind("ItemId,UserId,Valor")] LanceViewModel lance) { var item = _itemRepository.GetItemLeilaoByid(lance.ItemId); if (lance.Valor > item.ValorFinal && lance.Valor > item.Valorinicial) { item.ValorFinal = lance.Valor.Value; _itemRepository.AtualizarItem(item); _context.Lances.Add(new Lance { ItemId = lance.ItemId, UserId = lance.UserId, Valor = lance.Valor.Value }); _context.SaveChanges(); return(RedirectToAction("Index")); } else { return(View("DarLance", new LanceViewModel { ItemId = lance.ItemId, UserId = lance.UserId })); } }