public bool DeleteCommoditySource(CommoditySource commoditySource) { if (commoditySource == null) return false; _unitOfWork.CommoditySourceRepository.Delete(commoditySource); _unitOfWork.Save(); return true; }
public static CommoditySourceViewModel BindCommoditySourceViewModel(CommoditySource commoditySource) { return new CommoditySourceViewModel() { CommoditySourceID=commoditySource.CommoditySourceID, Name=commoditySource.Name }; }
public static CommoditySource BindCommoditySource(CommoditySourceViewModel commoditySourceViewModel, CommoditySource commoditySource = null) { var target = commoditySource ?? new CommoditySource(); target.CommoditySourceID = commoditySourceViewModel.CommoditySourceID; target.Name = commoditySourceViewModel.Name; return target; }
public ActionResult Create(CommoditySource commoditysource) { if (ModelState.IsValid) { _commoditySourceService.AddCommoditySource(commoditysource); return Json(new { success = true }); } return PartialView(commoditysource); }
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); }
public ActionResult Edit(CommoditySource commoditysource) { if (ModelState.IsValid) { _commoditySourceService.EditCommoditySource(commoditysource); return Json(new { success = true }); //return RedirectToAction("Index"); } return PartialView(commoditysource); }
public bool EditCommoditySource(CommoditySource commoditySource) { _unitOfWork.CommoditySourceRepository.Edit(commoditySource); _unitOfWork.Save(); return true; }