예제 #1
0
        public bool UpdateDeleteEstate(RealEstateDeleteEstateDto model)
        {
            try
            {
                var now = DateTime.Now;

                var item = _realEstateEntities.Estates.Find(model.Id);
                if (model.AccountId != item.AccountId)
                {
                    return(false);
                }
                item.IsDelete    = model.IsDelete;
                item.CreatedDate = now;
                _realEstateEntities.SaveChanges();
                var Town       = item.Town.Name;
                var EstateCode = item.EstateCode;
                Task.Run(() =>
                {
                    NotificationSender.Instance.Send($"Notification ", $" {EstateCode} - {Town} was deleted");
                });
                return(true);
            }
            catch (System.Exception)
            {
                return(false);
            }
        }
예제 #2
0
        public async Task <bool> UpdateDeleteProduct(RealEstateDeleteEstateDto arguments)
        {
            var result = await Service.Post <bool, NullServiceObject>(GenerateUrl("UpdateDeleteEstate"), arguments);

            await HandleResponseShowError(result);

            return(result?.Response?.Data ?? false);
        }
예제 #3
0
        public async Task <bool> DeleteProduct()
        {
            ProductItemViewModel product = null;

            switch (ProductFilters.Instance.ProductType)
            {
            case ProductType.WillBeExpired:
                product = WillBeExpiredProducts.ElementAt(ItemIndex);
                break;

            default:
                product = Products.ElementAt(ItemIndex);
                break;
            }
            if (product != null)
            {
                var arguments = new RealEstateDeleteEstateDto {
                    Id = product.Id, AccountId = App.AccountInfo.Id, IsDelete = true
                };
                IsBusy = true;
                bool result = await ProductService.UpdateDeleteProduct(arguments);

                IsBusy = false;
                if (result)
                {
                    switch (ProductFilters.Instance.ProductType)
                    {
                    case ProductType.WillBeExpired:
                        WillBeExpiredProducts.RemoveAt(ItemIndex);
                        break;

                    default:
                        Products.RemoveAt(ItemIndex);
                        break;
                    }
                }
                ItemIndex = -1;
                return(result);
            }
            return(false);
        }
예제 #4
0
        public async Task <bool> DeleteProduct()
        {
            var product = Products.ElementAt(ItemIndex);

            if (product != null)
            {
                var arguments = new RealEstateDeleteEstateDto {
                    Id = product.Id, AccountId = App.AccountInfo.Id, IsDelete = true
                };
                IsBusy = true;
                bool result = await ProductService.UpdateDeleteProduct(arguments);

                IsBusy = false;
                if (result)
                {
                    Products.RemoveAt(ItemIndex);
                }
                return(result);
            }
            return(false);
        }
예제 #5
0
        public async Task <IHttpActionResult> UpdateDeleteEstate(RealEstateDeleteEstateDto arguments)
        {
            bool update = _service.UpdateDeleteEstate(arguments);

            return(Ok(RealEstateResponse <bool> .Create(update)));
        }