public T Create(T item) { try { dataset.Add(item); _context.SaveChanges(); } catch (Exception) { throw; } return(item); }
public void SlotOut(string plate, RestApiContext _restApiContext) { int index = TicketList.FindIndex(x => x.Vehicle.plate == plate); if (index != -1) { TicketList[index].TimeOut = DateTime.Now; double cost = CalcPayment(TicketList[index]); TicketList[index].Cost = cost; } _restApiContext.Tickets.Add(TicketList[index]); _restApiContext.SaveChanges(); //MessageBox.Show("Tutar:" + cost.ToString(), "Ücretiniz"); //return TicketList; }
public void SlotIn(Vehicle vehicle, RestApiContext _restApiContext) { Ticket ticket = new Ticket(); ticket.Vehicle = vehicle; ticket.TimeIn = DateTime.Now; _restApiContext.Tickets.Add(ticket); _restApiContext.SaveChanges(); //if (!IsEmpty(_restApiContext)) //{ // throw new Exception("Otopark Dolu!"); //} //if (IsAlreadyIn(vehicle.plate, _restApiContext)) //{ // throw new Exception("Araç İçerde"); //} }
public int SaveChanges() { return(_context.SaveChanges()); }
public bool Save() { return(_context.SaveChanges() >= 0); }