Esempio n. 1
0
        /// <summary>
        /// Adding new data to population register
        /// </summary>
        /// <param name="newPopulationRegistration"></param>
        /// <returns> whether registration was successfull or not</returns>
        public bool Add(PopulationRegistrationDto newPopulationRegistration)
        {
            if (CheckNullEntries(newPopulationRegistration)) //checking for null or whitespace entries
            {
                PopulationRegistration newHouse = mapper.Mapper.Map <PopulationRegistration>(newPopulationRegistration);

                bool result = populationRegistrationRepository.Add(newHouse);
                return(result);
            }
            else
            {
                return(false);
            }
        }
        // POST: api/PopulationRegistration
        public HttpResponseMessage Post([FromBody] PopulationRegistrationDto newPopulationRegistration)
        {
            ResponseFormat <bool> response = new ResponseFormat <bool>();

            response.Data = populationRegistrationService.Add(newPopulationRegistration);
            if (response.Data)
            {
                response.message = "New Population Registered Added";
                response.success = true;
                return(Request.CreateResponse(HttpStatusCode.OK, response));
            }
            response.message = "Cannot Enter Population Data";
            response.success = false;
            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }