public void DeleteProductInvoiceDetailRs(int Id) { ProductInvoiceDetail deleteProductInvoiceDetailRs = GetProductInvoiceDetailById(Id); deleteProductInvoiceDetailRs.IsDeleted = true; UpdateProductInvoiceDetail(deleteProductInvoiceDetailRs); }
public void DeleteProductInvoiceDetail(List <ProductInvoiceDetail> list) { foreach (var item in list) { var listlog = GetAllUsingServiceLog().Where(x => x.ServiceInvoiceDetailId == item.Id).Select(x => x.Id).ToList(); var listlogReminder = GetAllLogServiceRemminder().Where(x => x.ProductInvoiceDetailId == item.Id).Select(x => x.Id).ToList(); foreach (var logId in listlog) { var listlogDetail = GetAllUsingServiceLogDetail().Where(x => x.UsingServiceId == logId).Select(x => x.Id).ToList(); foreach (var logDetailId in listlogDetail) { UsingServiceLogDetail deleteUsingServiceLogDetail = GetUsingServiceLogDetailById(logDetailId); Context.UsingServiceLogDetail.Remove(deleteUsingServiceLogDetail); Context.Entry(deleteUsingServiceLogDetail).State = EntityState.Deleted; } UsingServiceLog deleteUsingServiceLog = GetUsingServiceLogById(logId); Context.UsingServiceLog.Remove(deleteUsingServiceLog); Context.Entry(deleteUsingServiceLog).State = EntityState.Deleted; } foreach (var reminder in listlogReminder) { LogServiceRemminder deleteLogServiceRemminder = GetLogServiceRemminderById(reminder); Context.LogServiceRemminder.Remove(deleteLogServiceRemminder); Context.Entry(deleteLogServiceRemminder).State = EntityState.Deleted; } ProductInvoiceDetail deletedProductInvoiceDetail = GetProductInvoiceDetailById(item.Id); Context.ProductInvoiceDetail.Remove(deletedProductInvoiceDetail); Context.Entry(deletedProductInvoiceDetail).State = EntityState.Deleted; } Context.SaveChanges(); }
public void DeleteProductInvoiceDetail(int Id) { ProductInvoiceDetail deletedProductInvoiceDetail = GetProductInvoiceDetailById(Id); Context.ProductInvoiceDetail.Remove(deletedProductInvoiceDetail); Context.Entry(deletedProductInvoiceDetail).State = EntityState.Deleted; Context.SaveChanges(); }
public void DeleteProductInvoiceDetail(IEnumerable <ProductInvoiceDetail> list) { for (int i = 0; i < list.Count(); i++) { ProductInvoiceDetail deletedProductInvoiceDetail = GetProductInvoiceDetailById(list.ElementAt(i).Id); Context.ProductInvoiceDetail.Remove(deletedProductInvoiceDetail); Context.Entry(deletedProductInvoiceDetail).State = EntityState.Deleted; } Context.SaveChanges(); }
public void UpdateProductInvoiceDetail(ProductInvoiceDetail ProductInvoiceDetail) { Context.Entry(ProductInvoiceDetail).State = EntityState.Modified; Context.SaveChanges(); }
public void InsertProductInvoiceDetail(ProductInvoiceDetail ProductInvoiceDetail) { Context.ProductInvoiceDetail.Add(ProductInvoiceDetail); Context.Entry(ProductInvoiceDetail).State = EntityState.Added; Context.SaveChanges(); }