public ActionResult Create(CommodityGrade commoditygrade) { if (ModelState.IsValid) { _commodityGradeService.AddCommodityGrade(commoditygrade); return Json(new { success = true }); } return PartialView(commoditygrade); }
public void CanDoEditPostBack() { //ACT var commodityGrade = new CommodityGrade {CommodityGradeID = 1, Name = "1st Grade", Description = null, SortOrder = 1 }; var jsonResult = _commodityGradeController.Edit(commodityGrade) as JsonResult; //ASSERT Assert.NotNull(jsonResult); dynamic data = jsonResult.Data; Assert.AreEqual(true, data.success); }
public ActionResult Edit(CommodityGrade commoditygrade) { if (ModelState.IsValid) { _commodityGradeService.EditCommodityGrade(commoditygrade); return Json(new { success = true }); //return RedirectToAction("Index"); } return PartialView(commoditygrade); }