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