Пример #1
0
        public async Task <ActionResult <Association> > PostProject(Association association)
        {
            _context.Association.Add(association);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAssociationById", new { id = association.AssociationId }, association));
        }
Пример #2
0
        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());
        }