public void Init() { this.ConfigureMapper(); this._context = new FakeSchoolSystemContext(); Subject subject = new Subject() { Name = "Математика" }; _context.Subjects.Add(subject); Grade grade = new Grade() { Value = 1, Subjects = new HashSet <Subject> { subject } }; Grade grade2 = new Grade() { Value = 2, Subjects = new HashSet <Subject> { subject } }; _context.Grades.Add(grade); _context.Grades.Add(grade2); this._service = new GradesService(this._context); this._controller = new GradesController(this._service); }
public ActionResult Create(string name, decimal sale) { try { if (string.IsNullOrWhiteSpace(name)) { return(Json(new ResultMsg() { Code = -1, CodeText = "请输入名称" })); } var model = new Grades(); model.name = name; model.sale = sale; if (IGradesService.Insert(model) > 0) { return(Json(new ResultMsg() { Code = 0 })); } return(Json(new ResultMsg() { Code = -1, CodeText = "添加失败" })); } catch (Exception ex) { return(Json(new ResultMsg() { Code = -1, CodeText = "系统错误,联系管理员" })); } }
public void Init() { this.ConfigureMapper(); this._context = new FakeSchoolSystemContext(); this._service = new GradesService(this._context); this._controller = new GradesController(this._service); }
public List <ListGrade> AjaxQuery(GradesRequest request) { var data = new List <ListGrade>(); var query = IGradesService.Query(request); if (query != null) { var roles = _securityHelper.GetCurrentUser().CurrentUser.Roles.ToList(); data = query.ModelList.Select(x => new ListGrade(x)).ToList(); foreach (var item in data) { if (roles[0].IsSuper || roles[0].Permissions.Contains("EditGrades")) { item.boor += "<a href='#' onclick=OperatorThis('Edit','/Grades/Edit/" + item.gradeId + "') class='tablelink'>编辑 </a> "; } if (roles[0].IsSuper || roles[0].Permissions.Contains("DeleteGrades")) { item.boor += "<a href='#' onclick=OperatorThis('Delete','/Grades/Delete/" + item.gradeId + "') class='tablelink'>删除 </a> "; } } pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, query.TotalCount); } else { pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, 0); } return(data); }
public EvaluationsController(ILogger <EvaluationsController> logger, IAbsencesService absencesService, IGradesService gradesService, IStudentsService studentsService, ISubjectsService subjectsService) { _logger = logger; _absencesService = absencesService; _gradesService = gradesService; _studentsService = studentsService; _subjectsService = subjectsService; }
public AscentsController( IAscentsService ascentsService, IGradesService gradesService, IStylesService stylesService) { this.ascentsService = ascentsService; this.gradesService = gradesService; this.stylesService = stylesService; }
public PaymentsController( IConfiguration configuration, IPaymentsService paymentsService, IGradesService gradesService) { this.configuration = configuration; this.paymentsService = paymentsService; this.gradesService = gradesService; }
public void Setup() { _gradesRepositoryMock = new Mock <IDeletableEntityRepository <Grade> >(); _teachersRepositoryMock = new Mock <IRepository <Teacher> >(); _studentSubjectsRepositoryMock = new Mock <IRepository <StudentSubject> >(); _gradesService = new GradesService( _gradesRepositoryMock.Object, _teachersRepositoryMock.Object, _studentSubjectsRepositoryMock.Object); }
public InitializeWithPrimaryDataController(IRegionsService regionsService, ISchoolsService schoolsService, IClassesService classesService, ISubjectsService subjectsService, IStudentsService studentsService, IStudentsSubjectsService studentsSubjectsService, IGradesService gradesService) { this.regionsService = regionsService; this.schoolsService = schoolsService; this.classesService = classesService; this.subjectsService = subjectsService; this.studentsService = studentsService; this.studentsSubjectsService = studentsSubjectsService; this.gradesService = gradesService; }
public BouldersController( IBouldersService bouldersService, ICountriesService countriesService, ICitiesService citiesService, IGymsService gymsService, IGradesService gradesService, ICloudinaryService cloudinaryService) { this.bouldersService = bouldersService; this.countriesService = countriesService; this.citiesService = citiesService; this.gymsService = gymsService; this.gradesService = gradesService; this.cloudinaryService = cloudinaryService; }
public void Query() { var request = new GradesRequest(); var query = IGradesService.Query(request); if (query != null) { List = query.ModelList.Select(x => new ListGrade(x)).ToList(); pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, query.TotalCount); } else { List = new List <ListGrade>(); pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, 0); } }
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)); } }
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 GradesController(IGradesService gradesService) { this.gradesService = gradesService; }
public GradesController(IGradesService service) { this.service = service; }
public HomeController(IGradesService gradesService, IStylesService stylesService) { this.gradesService = gradesService; this.stylesService = stylesService; }
public HomeController(ILogger <HomeController> logger, IGradesService gradesService) { _logger = logger; _gradeService = gradesService; }