コード例 #1
0
ファイル: CommoditySourceService.cs プロジェクト: robela/cats
 public bool DeleteCommoditySource(CommoditySource commoditySource)
 {
     if (commoditySource == null) return false;
     _unitOfWork.CommoditySourceRepository.Delete(commoditySource);
     _unitOfWork.Save();
     return true;
 }
コード例 #2
0
        public static CommoditySourceViewModel BindCommoditySourceViewModel(CommoditySource commoditySource)
        {
            return new CommoditySourceViewModel()
            {
                CommoditySourceID=commoditySource.CommoditySourceID,
                Name=commoditySource.Name

            };
        }
コード例 #3
0
        public static CommoditySource BindCommoditySource(CommoditySourceViewModel commoditySourceViewModel, CommoditySource commoditySource = null)
        {
            var target = commoditySource ?? new CommoditySource();

                target.CommoditySourceID = commoditySourceViewModel.CommoditySourceID;
                target.Name = commoditySourceViewModel.Name;

            return target;
        }
コード例 #4
0
        public ActionResult Create(CommoditySource commoditysource)
        {
            if (ModelState.IsValid)
            {
                _commoditySourceService.AddCommoditySource(commoditysource);
                return Json(new { success = true });
            }

            return PartialView(commoditysource);
        }
コード例 #5
0
        public void CanDoEditPostBack()
        {
            //ACT
            var commoditySource = new CommoditySource { Name = "Donation" };
            var jsonResult = _commoditySourceController.Edit(commoditySource) as JsonResult;

            //ASSERT
            Assert.NotNull(jsonResult);
            dynamic data = jsonResult.Data;
            Assert.AreEqual(true, data.success);
        }
コード例 #6
0
 public ActionResult Edit(CommoditySource commoditysource)
 {
     if (ModelState.IsValid)
     {
         _commoditySourceService.EditCommoditySource(commoditysource);
         return Json(new { success = true });
         //return RedirectToAction("Index");
     }
     return PartialView(commoditysource);
 }
コード例 #7
0
ファイル: CommoditySourceService.cs プロジェクト: robela/cats
 public bool EditCommoditySource(CommoditySource commoditySource)
 {
     _unitOfWork.CommoditySourceRepository.Edit(commoditySource);
     _unitOfWork.Save();
     return true;
 }