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); }