// // 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()); }
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")); }
// // 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)); }
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 ")); } }
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")); } }
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")); } }
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")); } }
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")); } }
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")); } }
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")); } }
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")); } }