/// <summary> /// Get populationDetails from database using ID of person /// </summary> /// <param name="id"></param> /// <returns></returns> public PopulationRegistrationDTO GetPopulationRegistrationByIdDAL(int id) { using (CensusDataDigitalizationContext db = new CensusDataDigitalizationContext()) { PopulationRegistrationEntity populationRegistrationEntity = db.PopulationRegistrationEntity.Find(id); PopulationRegistrationDTO populationRegistrationDTO = mapPopulationRegistrationEntity2DTO.Map <PopulationRegistrationDTO>(populationRegistrationEntity); return(populationRegistrationDTO); } }
public bool Update(PopulationRegistrationDTO value) { PopulationRegistration val = new PopulationRegistration(); val = mapper.PopulationRegistrationDTOToPopulationRegistration(value); val.ModifiedOn = DateTime.Now; house.Update(val); return(true); }
public IHttpActionResult GetPopulationRegistrationById(int id) { IHttpActionResult result; PopulationRegistrationViewModel populationViewModel; PopulationRegistrationDTO populationDTO = populationRegistrationBAL.GetPopulationRegistrationByIdBAL(id); populationViewModel = mapPopulationRegistrationDTO2ViewModel.Map <PopulationRegistrationViewModel>(populationDTO); if (populationViewModel == null) { result = NotFound(); } else { result = Ok(populationViewModel); } return(result); }
public IHttpActionResult PostNationalPopulationEntity(PopulationRegistrationViewModel populationViewModel) { IHttpActionResult result; PopulationRegistrationDTO populationDTO = mapPopulationRegistrationViewModel2DTO.Map <PopulationRegistrationDTO>(populationViewModel); PopulationRegistrationDTO populationAdded = populationRegistrationBAL.AddPopulationBAL(populationDTO); populationViewModel = mapPopulationRegistrationDTO2ViewModel.Map <PopulationRegistrationViewModel>(populationAdded); if (populationViewModel != null) { result = Ok(populationViewModel); } else { result = BadRequest(); } return(result); }
/// <summary> /// Add Population Details to DataBase. /// </summary> /// <param name="populationRegistrationDTO"></param> /// <returns></returns> public PopulationRegistrationDTO AddPopulationDAL(PopulationRegistrationDTO populationRegistrationDTO) { try { using (CensusDataDigitalizationContext db = new CensusDataDigitalizationContext()) { PopulationRegistrationEntity populationEntity; populationEntity = mapPopulationRegistrationDTO2Entity.Map <PopulationRegistrationEntity>(populationRegistrationDTO); PopulationRegistrationEntity createdPopulationRegistrationEntity = db.PopulationRegistrationEntity.Add(populationEntity); db.SaveChanges(); PopulationRegistrationDTO createdUserDTO = mapPopulationRegistrationEntity2DTO.Map <PopulationRegistrationDTO>(createdPopulationRegistrationEntity); return(createdUserDTO); } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e); return(null); } }
public HttpResponseMessage Add([FromBody] PopulationRegistrationDTO val) { return(Request.CreateResponse(HttpStatusCode.OK, this.member.Insert(val))); }
/// <summary> /// Passes the data from DAC to Controller for a person with given ID /// </summary> /// <param name="id"></param> /// <returns></returns> public PopulationRegistrationDTO GetPopulationRegistrationByIdBAL(int id) { PopulationRegistrationDTO populationDTO = populationDAC.GetPopulationRegistrationByIdDAL(id); return(populationDTO); }
/// <summary> /// Passes the data from Controller to DAC For the population. /// </summary> /// <param name="population"></param> /// <returns></returns> public PopulationRegistrationDTO AddPopulationBAL(PopulationRegistrationDTO population) { PopulationRegistrationDTO populationCreated = populationDAC.AddPopulationDAL(population); return(populationCreated); }
public PopulationRegistration PopulationRegistrationDTOToPopulationRegistration(PopulationRegistrationDTO houselist) { return(Mapper.Map <PopulationRegistration>(houselist)); }