public async Task <bool> Update(int id, Student student)
        {
            _context.Update(student);
            await _context.SaveChangesAsync();

            return(true);
        }
Esempio n. 2
0
        public async Task <bool> Update(int id, Major major)
        {
            if (major == null)
            {
                throw new Exception("Major input cannot be null");
            }
            if (id != major.Id)
            {
                throw new Exception("Id does not match Major.Id");
            }
            //_context.Entry(major).State = EntityState.Modified;
            _context.Update(major);

            await _context.SaveChangesAsync();

            return(true);
        }