public static Sach.sach Nhapsach(Sach.listsach a, string ghichu) { Console.WriteLine(ghichu); Sach.sach book; Console.Write("Ma sach_ISBN: "); nhapmasach: string isbn = Console.ReadLine(); if (FindBook.Tramasach(a, isbn) == -1) { book.Masach_ISBN = isbn; } else { Console.WriteLine("Sach da ton tai."); Console.Write("Nhap lai ma sach ISBN: "); goto nhapmasach; } Console.Write("Ten sach: "); book.Tensach = Console.ReadLine(); Console.Write("Tac gia: "); book.Tacgia = Console.ReadLine(); Console.Write("Nha xuat ban: "); book.Nhaxuatban = Console.ReadLine(); Console.Write("Gia sach: "); book.Giasach = int.Parse(Console.ReadLine()); nhaploaisach: Console.WriteLine("(Sach Tieng Viet - 0; Sach Ngoai van - 1)"); Console.Write("Loai sach: "); int k; k = int.Parse(Console.ReadLine()); if (k == 0) { book.Loaisach = "Sach Tieng Viet"; } else if (k == 1) { book.Loaisach = "Sach Ngoai van"; } else { Console.WriteLine("Loai sach khong ton tai moi nhap lai"); goto nhaploaisach; } Console.WriteLine(book.Loaisach); Console.Write("So luong: "); book.Tongsoluong = int.Parse(Console.ReadLine()); book.Slmuon = 0; book.Slhientai = book.Tongsoluong; return(book); }
public static void Xoasach(Sach.listsach a) { string MS; int vitri; Console.WriteLine("XOA THONG TIN SACH"); Console.Write("Nhap vao Ma so cua sach:"); MS = Console.ReadLine(); vitri = FindBook.Tramasach(a, MS); if (vitri == -1) { Console.WriteLine("Khong co ma sach nay."); } else { int n = a.dssach.Length; for (int i = vitri; i <= n; i++) { a.dssach[i] = a.dssach[i + 1]; n--; } } }