Beispiel #1
0
        public async Task <IActionResult> PutTrackerProjects(int id, TrackerProjects trackerProjects)
        {
            if (id != trackerProjects.ProjectId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Beispiel #2
0
 public async Task <ActionResult <TrackerProjects> > PostTrackerProjects(TrackerProjects trackerProjects)
 {
     if (ModelState.IsValid)
     {
         if (_context.TrackerProjects.Any(x => x.SubSysId == trackerProjects.SubSysId && x.ProjectName == trackerProjects.ProjectName))
         {
             return(Conflict("Project name already exsists"));
         }
         else
         {
             _context.TrackerProjects.Add(trackerProjects);
             await _context.SaveChangesAsync();
         }
     }
     return(CreatedAtAction("GetTrackerProjects", new { id = trackerProjects.ProjectId }, trackerProjects));
 }