public async Task <ActionResult <Client> > PostClient(Client client)
        {
            _context.Clients.Add(client);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetClient", new { id = client.ClientId }, client));
        }
示例#2
0
        public async Task <IActionResult> PutPosition(int id, Position position)
        {
            if (id != position.PositionId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#3
0
        public async Task <ActionResult <Project> > PostProject(Project project)
        {
            _context.Projects.Add(project);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetProject", new { id = project.ProjectId }, project));
        }
        public async Task <IActionResult> PutSkill(int id, Skill skill)
        {
            if (id != skill.SkillId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#5
0
        public async Task <IActionResult> PutHireRequest(int id, HireRequest hireRequest)
        {
            if (id != hireRequest.HireRequestId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <ActionResult <Contractor> > PostContractor(Contractor contractor)
        {
            _context.Contractors.Add(contractor);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetContractor", new { id = contractor.ContractorId }, contractor));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ScannedID,Username,EmailID,Password,ComparePassword,TemplateFormatDB")] FingerprintModel fingerprintModel)
        {
            if (id != fingerprintModel.ScannedID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    db.Update(fingerprintModel);
                    await db.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FingerprintModelExists(fingerprintModel.ScannedID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(fingerprintModel));
        }