Ejemplo n.º 1
0
        public ActionResult Delete(int id)
        {
            var vSuccess = true;
            var vErro = string.Empty;

            try
            {
                using (ctx)
                {
                    var srvClassroom = new ClassroomService(ctx);
                    var oClassroom = srvClassroom.Sigle(id);

                    vSuccess = srvClassroom.DeleteAndSave(oClassroom);
                }
            }
            catch (Exception ex)
            {
                vSuccess = false;
                vErro = "Ocorreu um erro durante a exclusão! " + ex.Message;
            }

            return Json(new { success = vSuccess, message = vErro });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Apresenta a tela para edição de uma turma
        /// </summary>
        /// <param name="id">Código de identificação da turma</param>
        /// <returns></returns>
        public ActionResult Edit(int id)
        {
            using (ctx)
            {
                var srvClassroom = new ClassroomService(ctx);
                var oClassroom = srvClassroom.Sigle(id);

                // Cria uma lista de escolas para preencher o dropdownlist
                var srvCollege = new CollegeService(ctx);
                var lstColleges = srvCollege.GetAll();

                ViewBag.Colleges = new SelectList(lstColleges, "ID", "Name");

                return PartialView("_ModalForm", oClassroom);
            }
        }