2 лаба усл правки
This commit is contained in:
parent
8a96f638b3
commit
fdce636b56
5
.gitignore
vendored
5
.gitignore
vendored
@ -14,6 +14,11 @@
|
|||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
*.userprefs
|
*.userprefs
|
||||||
|
|
||||||
|
# dll файлы
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
/TravelCompany/ImplementationExtensions
|
||||||
|
|
||||||
# Mono auto generated files
|
# Mono auto generated files
|
||||||
mono_crash.*
|
mono_crash.*
|
||||||
|
|
||||||
|
@ -88,7 +88,9 @@ namespace TravelCompanyFileImplement.Implements
|
|||||||
public bool MakeSale(ITravelModel model, int count)
|
public bool MakeSale(ITravelModel model, int count)
|
||||||
{
|
{
|
||||||
var travel = source.Travels.FirstOrDefault(x => x.Id == model.Id);
|
var travel = source.Travels.FirstOrDefault(x => x.Id == model.Id);
|
||||||
int countInShops = source.Shops.SelectMany(x => x.ShopTravels).Sum(y => y.Key == model.Id ? y.Value.Item2 : 0);
|
int countInShops = source.Shops.SelectMany(x => x.ShopTravels)
|
||||||
|
.Where(y => y.Value.Item1.Id == model.Id)
|
||||||
|
.Sum(y => y.Value.Item2);
|
||||||
|
|
||||||
if (travel == null || countInShops < count)
|
if (travel == null || countInShops < count)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user