public async Task <IHttpActionResult> Put(decimal personid, WAGE wage)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (personid != wage.PERSONID)
            {
                return(BadRequest());
            }

            db.Entry(wage).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (!WageExists(personid))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> Put(decimal id, INCOMETAX incomeTax)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != incomeTax.ID)
            {
                return(BadRequest());
            }

            db.Entry(incomeTax).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (!IncomeTaxExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #3
0
        public async Task <IHttpActionResult> Put(decimal id, decimal bracketLevel, INCOMETAXBRACKET incomeTaxBracket)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != incomeTaxBracket.ID || bracketLevel != incomeTaxBracket.BRACKETLEVEL)
            {
                return(BadRequest());
            }

            db.Entry(incomeTaxBracket).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (!IncomeTaxBracketExists(id, bracketLevel))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }