示例#1
0
        public ActionResult Delete(string warehouseCode)
        {
            bool   bResult = WarehouseService.Delete(warehouseCode);
            string msg     = bResult ? "删除成功" : "删除失败";

            return(Json(JsonMessageHelper.getJsonMessage(bResult, msg, null), "text", JsonRequestBehavior.AllowGet));
        }
示例#2
0
 public HttpResponseMessage Delete(string id)
 {
     return(Execute(session =>
     {
         WarehouseService.Delete(id);
         return Request.CreateResponse(HttpStatusCode.NoContent);
     }));
 }
示例#3
0
        public void Throw_When_InvalidWarehouseId()
        {
            var options = Utils.GetOptions(nameof(Throw_When_InvalidWarehouseId));
            var mock    = new Mock <IAddressService>();

            using (var actContext = new DeliverItContext(options))
            {
                var sut = new WarehouseService(actContext, mock.Object);
                Assert.ThrowsException <ArgumentException>(() => sut.Delete(5));
            }
        }
 public IActionResult Delete(string id, string propertyName)
 {
     if (id != null && propertyName != null)
     {
         if (warehouseProductService.IsWarehouseProductsExist(id, propertyName))
         {
             WarehouseProduct warehouseProduct = warehouseProductService.Get(id, propertyName);
             warehouseProductService.Delete(warehouseProduct.id);
         }
         service.Delete(id);
         return(Ok());
     }
     return(BadRequest());
 }
示例#5
0
        public void Throw_When_AlreadyDeleted()
        {
            var options = Utils.GetOptions(nameof(Throw_When_AlreadyDeleted));
            var mock    = new Mock <IAddressService>();

            using (var arrContext = new DeliverItContext(options))
            {
                arrContext.Warehouses.AddRange(Utils.SeedWarehouses());
                arrContext.SaveChanges();
            }
            using (var actContext = new DeliverItContext(options))
            {
                var sut       = new WarehouseService(actContext, mock.Object);
                var warehouse = actContext.Warehouses.First(w => w.Id == 1);
                warehouse.IsDeleted = true;
                Assert.ThrowsException <ArgumentException>(() => sut.Delete(1));
            }
        }
示例#6
0
        public void ReturnsTrueIfDeleted()
        {
            var options = Utils.GetOptions(nameof(ReturnsTrueIfDeleted));
            var mock    = new Mock <IAddressService>();

            using (var arrContext = new DeliverItContext(options))
            {
                arrContext.Warehouses.AddRange(Utils.SeedWarehouses());
                arrContext.Addresses.AddRange(Utils.SeedAddresses());
                arrContext.Cities.AddRange(Utils.SeedCities());
                arrContext.SaveChanges();
            }
            using (var actContext = new DeliverItContext(options))
            {
                var sut    = new WarehouseService(actContext, mock.Object);
                var result = sut.Delete(1);
                Assert.AreEqual(actContext.Warehouses.Where(w => w.IsDeleted == false).Count(), 1);
                Assert.IsTrue(result);
            }
        }
        //#region IShipment


        //public IShippingService ShippingService
        //{
        //    get { return _serviceContext.ShippingService; }
        //}

        //#endregion


        #region IAppliedPayment



        #endregion

        #region IWarehouse

        public void DeleteWarehouseCatalogs()
        {
            var catalogs = WarehouseService.GetAllWarehouseCatalogs();

            WarehouseService.Delete(catalogs);
        }