One more LINQ
This commit is contained in:
parent
1d0a220011
commit
4badbb1569
@ -85,14 +85,10 @@ namespace IceCreamShopDatabaseImplement.Implements
|
||||
if (model == null)
|
||||
return null;
|
||||
using var context = new IceCreamShopDataBase();
|
||||
foreach (var iceCream in context.IceCreams)
|
||||
{
|
||||
if (iceCream.Id == model.IceCreamId)
|
||||
{
|
||||
model.IceCreamName = iceCream.IceCreamName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var iceCream = context.IceCreams.FirstOrDefault(x => (x.Id == model.IceCreamId));
|
||||
if (iceCream == null)
|
||||
return model;
|
||||
model.IceCreamName = iceCream.IceCreamName;
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user