示例#1
0
        public async Task <IActionResult> PutWork(int id, Work work)
        {
            if (id != work.WorkId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutScrapeRun(int id, ScrapeRun scrapeRun)
        {
            if (id != scrapeRun.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutPersonalInformation(int id, PersonalInformation personalInformation)
        {
            if (id != personalInformation.PersonalInformationId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutProject(int id, Project project)
        {
            if (id != project.ProjectId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#5
0
        public async Task <Statuses> UpdateEntry(Entry entry)
        {
            try
            {
                _cvContext.Entrys.Update(entry);
                var updated = await _cvContext.SaveChangesAsync();

                return(updated >= 1 ? Statuses.Ok : Statuses.NotFound);
            }
            catch (DbUpdateConcurrencyException)
            {
                // TODO: Add Logging.
                return(Statuses.NotFound);
            }
        }