public StudentController(Data.AppContext context) { _context = new StudentRepo(context); }
public string DeleteStudentById([FromRoute] int id) { StudentRepo.deleteById(id); return("Student removed successfully"); }
private void Borrow_Click(object sender, EventArgs e) { // DataGridViewRow dRow = borrowListDG.Rows[0]; if (borrowListDG.Rows.Count == 0) { MessageBox.Show("Select a book"); } else { studentRepo = new StudentRepo(); book = new Book(); //book.Image = Convert.ToByte[] (BookTable.Rows[e.RowIndex].Cells[0].Value.ToString()); //book.Image = new MemoryStream((byte[])BookTable.Rows[e.RowIndex].Cells[0].Value); book.BookId = booksDG.Rows[indexRow].Cells[1].Value.ToString(); book.Copies = Convert.ToInt32(booksDG.Rows[indexRow].Cells[2].Value.ToString()); book.Title = booksDG.Rows[indexRow].Cells[3].Value.ToString(); book.Author = booksDG.Rows[indexRow].Cells[4].Value.ToString(); book.Classification = booksDG.Rows[indexRow].Cells[5].Value.ToString(); book.Publisher = booksDG.Rows[indexRow].Cells[6].Value.ToString(); book.Subtitle = booksDG.Rows[indexRow].Cells[7].Value.ToString(); book.Copyright = booksDG.Rows[indexRow].Cells[8].Value.ToString(); book.Place = booksDG.Rows[indexRow].Cells[9].Value.ToString(); book.PublishDate = booksDG.Rows[indexRow].Cells[10].Value.ToString(); if (Convert.ToInt32(student_Borrowed.Text) == 3) { MessageBox.Show("Already 3 Books has been Taken"); } else { BorrowRecords b = new BorrowRecords(); b.BookID1 = null; b.BookID2 = null; b.BookID3 = null; // b.BookID1 = borrowListDG.Rows[0].Cells[0].Value.ToString(); //b.BookID2 = borrowListDG.Rows[1].Cells[0].Value.ToString(); // b.BookID3 = borrowListDG.Rows[2].Cells[0].Value.ToString(); b.StudentID = studentSearchTB.Text; b.BorrowDate = borrowedDate.Text; b.DueDate = dueDate.Text; if (borrowListDG.Rows[0] == null) { b.BookID1 = null; } else { b.BookID1 = borrowListDG.Rows[0].Cells[0].Value.ToString(); } if (borrowListDG.Rows[1].Displayed == false) { b.BookID2 = null; } else { MessageBox.Show("2 not null"); b.BookID2 = borrowListDG.Rows[1].Cells[0].Value.ToString(); } if (borrowListDG.Rows[2].Displayed == false) { b.BookID3 = null; } else { b.BookID3 = borrowListDG.Rows[2].Cells[0].Value.ToString(); } /*string a = Convert.ToString(borrowedDate.Value.Date); * string[] s = a.Split(' '); * MessageBox.Show(s[0]); * * MessageBox.Show(b.BorrowDate+"");*/ bool borrowResult = bookRepo.UpdateBook(book.BookId, book.Copies); bool borrowResult1 = bookRepo.UpdateRecords(b); bool borrowResult2 = studentRepo.UpdateStudentBorrow(studentSearchTB.Text, Convert.ToInt32(TotalCopiesLB.Text)); if (borrowResult && borrowResult1 && borrowResult2) { MessageBox.Show("Borrowed Succesfully"); } else { MessageBox.Show("Cannot Borrow"); } } } }
public Student GetStudentsbyId([FromRoute] int id) { return(StudentRepo.getById(id)); }
public string UpdateStudent([FromRoute] int id, [FromBody] Student student) { Student updatedStudent = StudentRepo.update(id, student); return(updatedStudent.ToString()); }
public ActionResult Index() { DataTable dt = new StudentRepo().GetStudentData(); return(View(dt)); }
public IEnumerable <Student> GetStudents() { return(StudentRepo.getAll()); }
public AccountController() { studentRepo = unit.StudentRepo(); employeeRepo = unit.EmployeeRepo(); }
public StudentController(StudentRepo studentrepo) { _studentrepo = studentrepo; }
public LoginBL(StudentRepo StudentRepo) { _StudentRepo = StudentRepo; }
public string DeleteStudentById([FromRoute] int id) { StudentRepo.deleteById(id); return("Deleted!"); }
public PgStudent() { InitializeComponent(); _repo = new StudentRepo(); }