public static Task <ServicesDetail> Add(ServicesDetail servicesDetail) { servicesDetail.Booking = servicesDetail.Booking.GetManaged(); servicesDetail.Service = servicesDetail.Service.GetManaged(); if (!servicesDetail.Service.IsActive) { throw new Exception("Dịch vụ " + servicesDetail.Service.Id + " đã ngừng cung cấp"); } return(ServicesDetailDataAccess.Add(servicesDetail)); }
public static Task <ServicesDetail> Update(ServicesDetail servicesDetail) { var servicesDetailInDatabase = GetAndCheckValid(servicesDetail.Id); servicesDetail.Service = servicesDetail.Service.GetManaged(); if (!servicesDetail.Service.IsActive) { throw new Exception("Dịch vụ " + servicesDetail.Service.Id + " đã ngừng cung cấp"); } return(ServicesDetailDataAccess.Update(servicesDetailInDatabase, servicesDetail)); }
public static IEnumerable <ServicesDetail> Get() => ServicesDetailDataAccess.Get();
public static ServicesDetail Get(int servicesDetailId) => ServicesDetailDataAccess.Get(servicesDetailId);
public static void Delete(int servicesDetailId) { var servicesDetailInDatabase = GetAndCheckValid(servicesDetailId); ServicesDetailDataAccess.Delete(servicesDetailInDatabase); }