예제 #1
0
        public async Task <IHttpActionResult> PutSummarySkill(int id, SummarySkillVM summarySkillVM)
        {
            SummarySkill summarySkill = ConvertToDBModel(summarySkillVM);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> PutUserProfile(int id, UserProfileVM userProfileVM)
        {
            UserProfile userProfile = ConvertToDBModel(userProfileVM);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #3
0
        public async Task <IHttpActionResult> PutMasterDetail(int id, MasterDetailVM masterDetailVM)
        {
            MasterDetail masterDetail = ConvertToDBModel(masterDetailVM);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #4
0
        public async Task <IHttpActionResult> PutEmployerHistory(int id, EmployerHistoryVM EmployerHistoryVM)
        {
            EmployerHistory EmployerHistory = ConvertToDBModel(EmployerHistoryVM);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }