Пример #1
0
    public List <string> Destination()
    {
        TestMVCentityEntities1 db = new TestMVCentityEntities1();
        var destination           = db.FareLists.Select(c => c.DestinationStation).ToList();

        return(destination);
    }
Пример #2
0
    public List <string> Source()
    {
        TestMVCentityEntities1 db = new TestMVCentityEntities1();
        var source = db.FareLists.Select(c => c.SourceStation).ToList();

        return(source);
    }
Пример #3
0
    public double Cal_Fare(int count, string source, string destination)
    {
        TestMVCentityEntities1 db = new TestMVCentityEntities1();
        var    fare = db.FareLists.Where(c => c.SourceStation == source).Where(q => q.DestinationStation == destination);
        double totalFare;

        if (fare.Count() > 0)
        {
            totalFare = fare.First().Fare *count;
            return(totalFare);
        }
        else
        {
            return(0);
        }
    }