25 lines
585 B
C#
25 lines
585 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using AutoCat.Utils;
|
|
using AutoCatCore.Model;
|
|
using AutoCatCore.Services.Storage;
|
|
|
|
namespace AutoCat.ViewModels;
|
|
|
|
public class HistoryViewModel(IStorageService storageService) : ViewModelBase
|
|
{
|
|
public IEnumerable<Vehicle> Vehicles { get; } = storageService.AllVehicles;
|
|
|
|
public async Task AddVehicle(Vehicle vehicle)
|
|
{
|
|
try
|
|
{
|
|
await storageService.AddVehicle(vehicle);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Alerts.ShowError(ex);
|
|
}
|
|
}
|
|
} |