public void delete(Guid bookedServiceID) { try { using (ApplicationDbContext db = new ApplicationDbContext()) { using (var transaction = db.Database.BeginTransaction()) { try { BookedServicesRepository repo = new BookedServicesRepository(db); BookedService bookedService = repo.getByID(bookedServiceID.ToString()); if (bookedService != null && !bookedService.IsPaid && !bookedService.IsFinished) { repo.delete(bookedService); db.SaveChanges(); transaction.Commit(); } else { transaction.Rollback(); } } catch (Exception ex) { transaction.Rollback(); } } } } catch (Exception ex) { } }
public List <BookedService> getByFamilyMemberID(Guid familyMemberID) { try { List <BookedService> listService = new List <BookedService>(); using (ApplicationDbContext db = new ApplicationDbContext()) { listService = new BookedServicesRepository(db).getBy(x => x.FamilyMemberID.Equals(familyMemberID)); } return(listService); } catch (Exception ex) { } return(new List <BookedService>()); }