Пример #1
0
 public bool DeleteCommodityType(CommodityType commodityType)
 {
     if (commodityType == null) return false;
     _unitOfWork.CommodityTypeRepository.Delete(commodityType);
     _unitOfWork.Save();
     return true;
 }
Пример #2
0
        public ActionResult Create(CommodityType commoditytype)
        {
            if (ModelState.IsValid)
            {
                _commodityTypeService.AddCommodityType(commoditytype);
                return Json(new { success = true });
            }

            return PartialView(commoditytype);
        }
        public void CanDoEditPostBack()
        {
            //ACT
            var commodityType = new CommodityType { Name = "Donation" };
            var jsonResult = _commodityTypeController.Edit(commodityType) as JsonResult;

            //ASSERT
            Assert.NotNull(jsonResult);
            dynamic data = jsonResult.Data;
            Assert.AreEqual(true, data.success);
        }
Пример #4
0
        public ActionResult CreateJson([DataSourceRequest] DataSourceRequest request, CommodityTypeViewModel viewModel)
        {
            if (viewModel != null && ModelState.IsValid)
            {
                CommodityType original = new CommodityType
                {
                    Name = viewModel.Name,

                };
                _commodityTypeService.AddCommodityType(original);
            }
            return Json(new[] { viewModel }.ToDataSourceResult(request, ModelState));
        }
Пример #5
0
 public bool EditCommodityType(CommodityType commodityType)
 {
     _unitOfWork.CommodityTypeRepository.Edit(commodityType);
     _unitOfWork.Save();
     return true;
 }
Пример #6
0
 public ActionResult Edit(CommodityType commoditytype)
 {
     if (ModelState.IsValid)
     {
         _commodityTypeService.EditCommodityType(commoditytype);
         return Json(new { success = true });
     }
        // ViewBag.CommodityTypeID = new SelectList(db.Warehouses, "CommodityTypeID", "Name", store.WarehouseID);
     return PartialView(commoditytype);
 }