Пример #1
0
        static void Main(string[] args)
        {
            BO           view = new BO();
            SinhVienView sv   = new SinhVienView()
            {
                MSSV = 7,
                Name = "Dorn",
                DTB  = 8.9,
                Lop  = "17T4"
            };

            Console.WriteLine(view.Update(sv));
        }
Пример #2
0
        public List <SinhVienView> GetAll()
        {
            List <SinhVienView> svs     = new List <SinhVienView>();
            List <SinhVien>     daoSvs  = _svs.GetAll();
            List <Lop>          daoLops = _lops.GetAll();

            foreach (SinhVien sv in daoSvs)
            {
                string       lop    = daoLops.Find(x => sv.IDLop.Equals(x.ID)).Name;
                SinhVienView svview =
                    new SinhVienView()
                {
                    MSSV = sv.MSSV, Name = sv.Name, DTB = sv.DTB, Lop = lop
                };
                svs.Add(svview);
            }
            return(svs);
        }
Пример #3
0
        public bool Update(SinhVienView sv)
        {
            List <SinhVien> sviens = _svs.GetByID(sv.MSSV);
            List <Lop>      lops   = _lops.GetByName(sv.Lop);

            if (sv == null || sviens.Any() || !lops.Any())
            {
                return(false);
            }
            SinhVien svien = new SinhVien()
            {
                MSSV  = sv.MSSV,
                Name  = sv.Name,
                DTB   = sv.DTB,
                IDLop = lops[0].ID
            };

            return(_svs.Update(svien));
        }