/// <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);
     }
 }
Exemple #2
0
        public bool Update(PopulationRegistrationDTO value)
        {
            PopulationRegistration val = new PopulationRegistration();

            val            = mapper.PopulationRegistrationDTOToPopulationRegistration(value);
            val.ModifiedOn = DateTime.Now;
            house.Update(val);

            return(true);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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)));
 }
Exemple #7
0
        /// <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);
        }
Exemple #8
0
        /// <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);
        }
Exemple #9
0
 public PopulationRegistration PopulationRegistrationDTOToPopulationRegistration(PopulationRegistrationDTO houselist)
 {
     return(Mapper.Map <PopulationRegistration>(houselist));
 }