Example #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));
        }
Example #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));
        }
        public async Task <IHttpActionResult> PostUserProfile(EducationDetailVM EducationDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.EducationDetails.Add(ConvertToDBModel(EducationDetail));
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = EducationDetail.ID }, EducationDetail));
        }
Example #5
0
        public async Task <IHttpActionResult> PostUserProfile(EmployerHistoryVM EmployerHistory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.EmployerHistories.Add(ConvertToDBModel(EmployerHistory));
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = EmployerHistory.ID }, EmployerHistory));
        }