Exemplo n.º 1
0
        public ActionResult ShowPartialGrades(string id)
        {
            GradesAccess  g     = new GradesAccess();
            List <Grades> items = g.getGrades(2);

            return(View(items));
        }
        //
        // GET: /Test/

        public ActionResult Index(int id)
        {
            GradesAccess  g     = new GradesAccess();
            List <Grades> items = g.getGrades(id);

            if (items.Count == 0)
            {
                return(Content("Brak ocen cząstkowych dla podanej realizacji."));
            }
            return(View(items));
        }
Exemplo n.º 3
0
        public ActionResult ShowRealizations()
        {
            GradesAccess       g     = new GradesAccess();
            List <Realization> items = g.getRealizations();

            foreach (Realization r in items)
            {
                Console.WriteLine(r.Id + " " + r.Semester + " " + r.Subject);
            }


            return(View(items));
        }
        //async Task<partialviewresult>
        //async Task<JsonResult>

        public ActionResult Create(int realizationId, string name, string maxValue)
        {
            //################### NO DB TESTS ###################
            //Grades g = new Grades { GradeID = 789, RealisationID = realizationId, Name = name, MaxValue = maxValue };
            //return Json(g);

            //GradesResult r = new GradesResult { msg = null, data = new Grades { GradeID = 898, RealisationID = realizationId, Name = name, MaxValue = maxValue } };
            //return Json(r);

            GradesAccess g = new GradesAccess();
            GradesResult r = g.addGrades(realizationId, name, maxValue);
            //return Json(r);
            GradesResult r2 = new GradesResult {
                msg = null, data = new Grades {
                    GradeID = 898, RealisationID = realizationId, Name = name, MaxValue = maxValue, TimeStamp = new byte[8]
                }
            };

            return(Json(r));
        }
        public ActionResult Save(int gradesId, string name, string maxValue, string stamp)
        {
            GradesAccess g = new GradesAccess();

            string[] parts    = stamp.Split('?');
            byte[]   transfer = new byte[8];
            for (int i = 0; i < 8; i++)
            {
                transfer[i] = Convert.ToByte(parts[i]);
            }

            GradesResult r = g.editGrades(gradesId, name, maxValue, transfer);

            return(Json(r));
            //################### NO DB TESTS ###################
            //GradesResult r = g.editGrades(gradesId, name, maxValue);

            //GradesResult r = new GradesResult { msg = null, data = new Grades { GradeID = gradesId } };
            //return Json(r);
            //return Content("asdf" + realizationId + name + maxValue);
        }
        //
        // GET: /Test/Delete/5

        /*
         *
         * public ActionResult Delete(int id)
         * {
         *  return View();
         * }
         *
         * //
         * // POST: /Test/Delete/5
         *
         * [HttpPost]
         * public ActionResult Delete(int id, FormCollection collection)
         * {
         *  try
         *  {
         *      // TODO: Add delete logic here
         *
         *      return RedirectToAction("Index");
         *  }
         *  catch
         *  {
         *      return View();
         *  }
         * }
         *
         */

        public ActionResult Delete(int gradeId, string stamp)
        {
            GradesAccess g = new GradesAccess();

            //byte[] transfer = GetBytes(stamp);

            string[] parts    = stamp.Split('?');
            byte[]   transfer = new byte[8];
            for (int i = 0; i < 8; i++)
            {
                transfer[i] = Convert.ToByte(parts[i]);
            }



            GradesResult r = g.removeGrades(gradeId, transfer);

            //GradesResult r = new GradesResult { msg = null, data = new Grades { GradeID = gradeId } };
            return(Json(r));
            //return Json(new { error = r.msg, id = gradeId });
        }