Esempio n. 1
0
 protected void RadGrid1_OnItemCommand(object sender, GridCommandEventArgs e)
 {
     if (e.CommandName == "EditRow")
     {
         mvwForm.SetActiveView(viwAddEdit);
         RowID = Convert.ToInt32(e.CommandArgument);
         var term = TermService.GetTerm(RowID);
         txtName.Text        = term.Name;
         chkIsActive.Checked = term.IsActive;
         txtName.Focus();
     }
 }
Esempio n. 2
0
        // PUT api/<controller>/5
        public IHttpActionResult Put(Term term)
        {
            IHttpActionResult result  = null;
            TermService       service = new TermService();

            if (service.GetTerm(term.ID) != null)
            {
                service.UpdateTerm(term);
                result = Ok(term);
            }
            else
            {
                result = NotFound();
            }

            return(result);
        }
Esempio n. 3
0
        public ActionResult Classes(int?id)  // term id
        {
            checkLogin();

            TERM displayingTerm = id != null?TermService.GetTerm((int)id) : CP.currentTerm;

            ClassViewModel CVM = new ClassViewModel()
            {
                classes      = ClassService.getClassViews(displayingTerm.ID),
                SelectedTerm = displayingTerm.ID,
                TermList     = CP.termSelectList,
                teachers     = CP.teacherSelectList,
                newClass     = new QE_CLASS()
            };

            ModelState.Clear();
            return(View(CVM));
        }
Esempio n. 4
0
        // GET api/<controller>/5
        public IHttpActionResult Get(int id)
        {
            IHttpActionResult result = null;

            TermService service = new TermService();

            Term term = service.GetTerm(id);

            if (term != null)
            {
                result = Ok(term);
            }
            else
            {
                result = NotFound();
            }

            return(result);
        }
Esempio n. 5
0
        // DELETE api/<controller>/5
        public IHttpActionResult Delete(int id)
        {
            IHttpActionResult result  = null;
            TermService       service = new TermService();

            Term term = service.GetTerm(id);

            if (term != null)
            {
                service.RemoveTerm(id);

                result = Ok(true);
            }
            else
            {
                result = NotFound();
            }

            return(result);
        }