예제 #1
0
        public bool AddDepartment(DepartmentViewModel model)
        {
            try
            {
                Departments departments = new Departments();

                departments.DepartName = model.DepartName;


                _context.Departments.Add(departments);
                _context.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #2
0
        public bool AddStudent(StudentViewModel model)
        {
            try
            {
                Student student = new Student
                {
                    FullName     = model.FullName,
                    Email        = model.Email,
                    DepartmentId = model.DepartmentID
                };

                _context.Student.Add(student);
                _context.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #3
0
        public bool AddSports(SportsViewModel model)
        {
            try
            {
                Sports sports = new Sports
                {
                    SportId    = model.SportID,
                    SportsType = model.SportsType,
                    IsOwingKit = model.IsOwingKit,

                    StudentId = model.StudentID
                };

                _context.Sports.Add(sports);
                _context.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #4
0
        public bool AddHalls(HallViewModel model)
        {
            try
            {
                Halls halls = new Halls
                {
                    HallId      = model.HallID,
                    HallName    = model.HallName,
                    KeyReturned = model.KeyReturned,
                    IsOwing     = model.IsOwing,
                    StudentId   = model.StudentID
                };

                _context.Halls.Add(halls);
                _context.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #5
0
        public bool AddFees(FeesViewModel model)
        {
            try
            {
                Fees fees = new Fees
                {
                    FeeId       = model.FeeID,
                    FeeAmount   = model.FeeAmount,
                    IsOwing     = model.IsOwing,
                    AmountPaid  = model.AmountPaid,
                    AmountOwing = model.AmountOwing,
                    StudentId   = model.StudentID
                };

                _context.Fees.Add(fees);
                _context.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #6
0
        public bool DeleteFees(int id)
        {
            try
            {
                Fees fees = _context.Fees.Where(x => x.FeeId == id).FirstOrDefault();


                _context.Fees.Remove(fees);
                _context.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #7
0
        public bool DeleteSports(int id)
        {
            try
            {
                Sports sports = _context.Sports.Where(x => x.SportId == id).FirstOrDefault();


                _context.Sports.Remove(sports);
                _context.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #8
0
        public bool DeleteHalls(int id)
        {
            try
            {
                Halls halls = _context.Halls.Where(x => x.HallId == id).FirstOrDefault();


                _context.Halls.Remove(halls);
                _context.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }