Esempio n. 1
0
        public async Task <IActionResult> PutProject(int id, Project project)
        {
            if (id != project.ID)
            {
                return(BadRequest());
            }

            _context.Entry(project).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProjectExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PutTask(int id, Education.Models.Task task)
        {
            if (id != task.ID)
            {
                return(BadRequest());
            }

            _context.Entry(task).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TaskExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 3
0
        public async Task <IActionResult> UpdateMajor(int id, Major major)
        {
            if (id != major.Id)
            {
                return(BadRequest());
            }

            _context.Entry(major).State = EntityState.Modified;

            try {
                await _context.SaveChangesAsync();
            } catch (DbUpdateConcurrencyException) {
                if (!MajorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public T Update(T entity)
        {
            _dbContext.Entry(entity).State = EntityState.Modified;

            return(entity);
        }