public IHttpActionResult PutTechnician(int id, Technician technician)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != technician.Id)
            {
                return(BadRequest());
            }

            try
            {
                repository.Put(technician);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TechnicianExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutProposal(int id, Proposal proposal)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != proposal.Id)
            {
                return(BadRequest());
            }

            try
            {
                repository.Put(proposal);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProposalExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 3
0
        public IHttpActionResult PutUserJob(int id, UserJob userJob)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != userJob.Id)
            {
                return(BadRequest());
            }

            try
            {
                repository.Put(userJob);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserJobExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }