public bool UpdateBet(UpdateBetModelView Updatemodel) { var Itemrepo = new ItemService(); string id = Itemrepo.GetById(Updatemodel.id.Substring(Updatemodel.id.IndexOf('-') + 1)).ItemRef; using (var Betrepo = new BetService()) { var model = Betrepo.GetById(Updatemodel.id); try { model.IsAccept = Updatemodel.ans; if (Updatemodel.ans == 2) { var item = Itemrepo.GetById(id); item.status = "Sold"; Itemrepo.Update(item); } Betrepo.Update(model); return(true); } catch { return(false); } } }
public void UpdateRead(string itemref) { var Betrepo = new BetService(); var item = Betrepo.GetById(itemref); item.IsRead = true; Betrepo.Update(item); }
public void BetService_UpdateBet_ShouldBeOk() { //Cenário _bet.NumbersBet = new List <int>() { 1, 2, 3, 4, 5, 9 }; _mockBetRepository.Setup(rp => rp.Update(_bet)).Returns(_bet); //Ação Bet updatedBet = _betService.Update(_bet); //Verificar _mockBetRepository.Verify(rp => rp.Update(_bet)); updatedBet.Should().Be(_bet); }