public IActionResult EditGrade(int id) { var grade = _gradesService.GetById <GradeInputModel>(id); var inputModel = new GradeModifyInputModel() { Id = id, Grade = grade }; return(View(inputModel)); }
public IHttpActionResult GetById(int id) { Grade grade = gradesService.GetById(id); if (grade == null) { return(NotFound()); } return(Ok(grade)); }
public ActionResult Deletes(string strIds) { ResultMsg result = new ResultMsg(); int sum = 0; if (!string.IsNullOrEmpty(strIds)) { var commodityIds = strIds.Split(','); transaction.BeginTransaction(); for (int i = 0; i < commodityIds.Length; i++) { var comm = IGradesService.GetById(Convert.ToInt32(commodityIds[i])); try { sum += IGradesService.Delete(comm); } catch (Exception) { result.CodeText = "不好意思,系统异常!"; return(Json(result)); } } transaction.Commit(); if (sum == commodityIds.Length) { result.Code = 1; result.CodeText = "删除成功!"; } else { result.Code = 2; result.CodeText = "删除失败!"; } return(Json(result)); } else { result.Code = 2; result.CodeText = "请选中您要删除的级别!"; return(Json(result)); } }
public ActionResult Delete(int id) { ResultMsg result = new ResultMsg(); var comm = IGradesService.GetById(id); if (comm != null) { IGradesService.Delete(comm); result.Code = 1; result.CodeText = "删除成功!"; return(Json(result)); } else { result.Code = 2; result.CodeText = "删除失败!"; return(Json(result)); } }