//
        // GET: /Students/Student/
        public ActionResult Index()
        {
            var sp    = new StudentProcess();
            var lista = sp.SelectList();

            return(View(lista));
        }
        // POST: Students/Create
        public ActionResult Create(Student std)
        {
            var sp = new StudentProcess();

            sp.Insert(std);
            return(RedirectToAction("Index"));
        }
        // GET: Students/Create
        public ActionResult Create()
        {
            var cp    = new StudentProcess();
            var lista = cp.SelectList();

            ViewData["Country"] = lista;
            return(View());
        }
Example #4
0
        public ActionResult Create(Student student)
        {
            var studentProcess = new StudentProcess();

            switch (student.Gender)
            {
            case "0": student.Gender = "Masculino"; break;

            case "1": student.Gender = "Femenino"; break;
            }
            studentProcess.Create(student);
            return(RedirectToAction("Index"));
        }
Example #5
0
        //
        // GET: /Students/Student/
        public ActionResult Index()
        {
            var studentProcess = new StudentProcess();
            var country        = new CountryProcess();
            var lista          = studentProcess.SelectList();
            var countries      = country.SelectList();

            foreach (var l in lista)
            {
                l.Pais = countries.Find(p => p.Id == l.CountryId);
            }
            return(View(lista));
        }
Example #6
0
        public ActionResult Post([FromBody] List <Student> student)
        {
            StudentProcess Process = new StudentProcess();
            var            result  = Process.Create(student);

            if (result == 1)
            {
                return(Ok("Insertion is done Successfully"));
            }
            else
            {
                return(NotFound("Insertion failed "));
            }
        }
Example #7
0
        public ActionResult Put([FromBody] List <Student> student)
        {
            StudentProcess process = new StudentProcess();
            var            result  = process.update(student);

            if (result == 1)
            {
                return(Ok("updated  Successfully"));
            }
            else
            {
                return(NotFound(" failed to update"));
            }
        }
Example #8
0
        public ActionResult <Student> GetByName(string name)
        {
            StudentProcess studentProcess = new StudentProcess();
            var            result         = studentProcess.GetDataByNmae(name);

            if (result.Count > 0)
            {
                return(Ok(result));
            }
            else
            {
                return(NotFound("No Records found with given Name"));
            }
        }
Example #9
0
        public ActionResult <Student> GetById(int id)
        {
            StudentProcess studentProcess = new StudentProcess();
            var            result         = studentProcess.getById(id);

            if (result.RollNumber == id && result.IsActive == true)
            {
                return(Ok(result));
            }
            else
            {
                return(NotFound("No Records found with Given ID"));
            }
        }
Example #10
0
        public ActionResult <List <Student> > Get()
        {
            StudentProcess process = new StudentProcess();
            var            result  = process.GetStudents();

            if (result.Count > 0)
            {
                return(Ok(result));
            }
            else
            {
                return(NotFound("No Records Found"));
            }
        }
Example #11
0
        public ActionResult Delete(int id)
        {
            StudentProcess process = new StudentProcess();
            var            result  = process.delete(id);

            if (result > 0)
            {
                return(Ok("Deleted successfully"));
            }
            else
            {
                return(NotFound("No record with given ID"));
            }
        }
Example #12
0
        public ActionResult DeleteMultiple([FromBody] List <int> list)
        {
            StudentProcess process = new StudentProcess();
            var            result  = process.DeleteMultiple(list);

            if (result.Count > 0)
            {
                return(Ok(result));
            }
            else
            {
                return(NotFound("No records found with given id List"));
            }
        }
Example #13
0
        public ActionResult GetByObject([FromBody] Student student)
        {
            StudentProcess process = new StudentProcess();
            var            result  = process.GetByObject(student);

            if (result.Count > 0)
            {
                return(Ok(result));
            }
            else
            {
                return(NotFound("No records found with given object"));
            }
        }