private async Task Delete(int id) { var apartment = Apartments.FirstOrDefault(p => p.Id.Equals(id)); var confirmed = await Js.InvokeAsync <bool>("confirm", $"Are you sure you want to delete the apartment with Id: {apartment.Id}?"); if (confirmed) { await OnDeleted.InvokeAsync(id); } }
internal IEnumerable <(int PayerId, int DaysLived, int OccupantCount)> GetApartmentPayerResidenceInfos(DateTime from, DateTime to, int apartmentId) { var apartment = Apartments.FirstOrDefault(a => a.ApartmentId == apartmentId); if (apartment is null) { throw new ArgumentNullException($"No Apartment With {apartmentId} Id Exists"); } return(apartment.GetPayerResisdenceInfo(from, to)); }
internal decimal GetApartmentArea(int apartmentId) { var apartment = Apartments.FirstOrDefault(a => a.ApartmentId == apartmentId); if (apartment is null) { throw new ArgumentNullException($"No Apartment With {apartmentId} Id Exists"); } return(apartment.Area); }
public Apartment Get(string apartmentCode) => Apartments != null?Apartments.FirstOrDefault(e => e.LocalCode == apartmentCode) : null;
public bool Contain(string apartmentCode) => Apartments.FirstOrDefault(e => e.LocalCode == apartmentCode) != null;