コード例 #1
0
        public async Task <IActionResult> PutMapCompanyTask([FromRoute] int id, [FromBody] MapCompanyTask mapCompanyTask)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != mapCompanyTask.CompTaskId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> PostMapCompanyTask([FromBody] MapCompanyTask mapCompanyTask)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.MapCompanyTask.Add(mapCompanyTask);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMapCompanyTask", new { id = mapCompanyTask.CompTaskId }, mapCompanyTask));
        }