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());
        }
예제 #2
0
        public async Task <ProjectModel> Add(ProjectModel apiModel)
        {
            _context.Projects.Add(apiModel.ToDbModel());
            await _context.SaveChangesAsync();

            return(apiModel);
        }