Ejemplo n.º 1
0
        public JsonResult Delete(long id)
        {
            var model = db.Delete(id);

            return(Json(new
            {
                status = model
            }));
        }
        private void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show($"Are you sure that you want to delete this?", "Delete", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                if (dgFurniture.Visibility.Equals(Visibility.Visible))
                {
                    FurnitureDAO.Delete(SelectedFurniture);
                }

                else if (dgFurnitureType.Visibility.Equals(Visibility.Visible))
                {
                    FurnitureTypeDAO.Delete(SelectedFurnitureType);
                }

                else if (dgSales.Visibility.Equals(Visibility.Visible))
                {
                    SaleDAO.Delete(SelectedSale);
                    SaleDAO.DeleteFurnitureSale(SelectedSale);
                }
                else if (dgUsers.Visibility.Equals(Visibility.Visible))
                {
                    UserDAO.Delete(SelectedUser);
                }

                else if (dgAdditionalService.Visibility.Equals(Visibility.Visible))
                {
                    AdditionalServiceDAO.Delete(SelectedAdditionalService);
                }
            }
        }
 public static void CheckSaleDate()
 {
     foreach (var sale in Project.Instance.SalesList)
     {
         int dateCompare = DateTime.Compare(sale.EndDate, DateTime.Now);
         if (dateCompare < 0 || sale.Deleted)
         {
             SaleDAO.Delete(sale);
             SaleDAO.DeleteFurnitureSale(sale);
         }
     }
 }