public IHttpActionResult PutCountry(int id, CountryViewModel CountryViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != CountryViewModel.Id) { return(BadRequest()); } Country country = new Country(); Mapper.CreateMap <CountryViewModel, Country>(); country = Mapper.Map <CountryViewModel, Country>(CountryViewModel); db.Entry(country).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CountryExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutQuestionChoicesViewModel(int id, QuestionsChoicesViewModel questionChoicesViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != questionChoicesViewModel.Id) { return(BadRequest()); } QuestionsChoices QuestionChoices = new QuestionsChoices(); Mapper.CreateMap <QuestionsChoicesViewModel, QuestionsChoices>(); QuestionChoices = Mapper.Map <QuestionsChoicesViewModel, QuestionsChoices>(questionChoicesViewModel); db.Entry(QuestionChoices).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!QuestionChoicesExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutSegmentsViewModel(int id, SegmentsViewModel segmentsViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != segmentsViewModel.Id) { return(BadRequest()); } Segments Segments = new Segments(); Mapper.CreateMap <SegmentsViewModel, Segments>(); Segments = Mapper.Map <SegmentsViewModel, Segments>(segmentsViewModel); db.Entry(Segments).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SegmentsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutAreaOfExpertise(int id, AreaOfExpertiseViewModel AreaOfExpertiseViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != AreaOfExpertiseViewModel.Id) { return(BadRequest()); } AreaOfExpertise AreaOfExpertise = new AreaOfExpertise(); Mapper.CreateMap <AreaOfExpertiseViewModel, AreaOfExpertise>(); AreaOfExpertise = Mapper.Map <AreaOfExpertiseViewModel, AreaOfExpertise>(AreaOfExpertiseViewModel); db.Entry(AreaOfExpertise).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AreaOfExpertiseExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutUserAnswersViewModel(int id, UserAnswersViewModel userAnswersViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != userAnswersViewModel.Id) { return(BadRequest()); } UserAnswers UserAnswers = new UserAnswers(); Mapper.CreateMap <UserAnswersViewModel, UserAnswers>(); UserAnswers = Mapper.Map <UserAnswersViewModel, UserAnswers>(userAnswersViewModel); db.Entry(UserAnswers).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!UserAnswersExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutUserMaster(String UserName, UserViewModel userViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (UserName != userViewModel.UserName) { return(NotFound()); } Users User = new Users(); Mapper.CreateMap <UserViewModel, Users>(); User = Mapper.Map <UserViewModel, Users>(userViewModel); db.Entry(User).State = EntityState.Modified; db.SaveChanges(); return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutJobApply(int id, JobApplyViewModel jobApplyViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != jobApplyViewModel.Id) { return(BadRequest()); } JobApply JobApply = new JobApply(); Mapper.CreateMap <JobApplyViewModel, JobApply>(); JobApply = Mapper.Map <JobApplyViewModel, JobApply>(jobApplyViewModel); db.Entry(JobApply).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!JobApplyExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutYearsOfExperienceViewModel(int id, YearsOfExperienceViewModel yearsOfExperienceViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != yearsOfExperienceViewModel.Id) { return(BadRequest()); } YearsOfExperience YearsOfExperience = new YearsOfExperience(); Mapper.CreateMap <YearsOfExperienceViewModel, YearsOfExperience>(); YearsOfExperience = Mapper.Map <YearsOfExperienceViewModel, YearsOfExperience>(yearsOfExperienceViewModel); db.Entry(YearsOfExperience).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!YearsOfExperienceExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }