Beispiel #1
0
 /// <summary>
 /// Gets the Result of House Listing From DataBase using Id of House
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public HouseListingDTO GetHouseListingByIdDAL(int id)
 {
     using (CensusDataDigitalizationContext db = new CensusDataDigitalizationContext())
     {
         HouseListingEntity houseListingEntity = db.HouseListingEntity.Find(id);
         HouseListingDTO    houseListingDTO    = mapHouseListingEntity2DTO.Map <HouseListingDTO>(houseListingEntity);
         return(houseListingDTO);
     }
 }
        public bool Update(HouseListingDTO value)
        {
            HouseListing val = new HouseListing();

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

            return(true);
        }
        public bool Insert(HouseListingDTO value)
        {
            HouseListing val = new HouseListing();

            val            = mapper.HouseDTOToHouse(value);
            val.CreatedOn  = DateTime.Now;
            val.ModifiedOn = DateTime.Now;
            house.Insert(val);

            return(true);
        }
Beispiel #4
0
        public IHttpActionResult GetHouseListing(int id)
        {
            IHttpActionResult result;
            HouseListingDTO   houseListingDTO = houseListingBAL.GetHouseListingByIdBAL(id);

            HouseListingViewModel houseListingViewModel = mapHouseListingDTO2ViewModel.Map <HouseListingViewModel>(houseListingDTO);

            if (houseListingViewModel == null)
            {
                result = Ok();
            }
            else
            {
                result = Ok(houseListingViewModel);
            }

            return(result);
        }
Beispiel #5
0
 /// <summary>
 /// Add the House Record to DataBase
 /// </summary>
 /// <param name="houseListingDTO"></param>
 /// <returns></returns>
 public HouseListingDTO AddHouseListingDAL(HouseListingDTO houseListingDTO)
 {
     try
     {
         using (CensusDataDigitalizationContext db = new CensusDataDigitalizationContext())
         {
             HouseListingEntity houseListingEntity        = mapHouseListingDTO2Entity.Map <HouseListingEntity>(houseListingDTO);
             HouseListingEntity createdHouseListingEntity = db.HouseListingEntity.Add(houseListingEntity);
             db.SaveChanges();
             HouseListingDTO createdHouseListingDTO = mapHouseListingEntity2DTO.Map <HouseListingDTO>(createdHouseListingEntity);
             return(createdHouseListingDTO);
         }
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine(e);
         return(null);
     }
 }
Beispiel #6
0
        public IHttpActionResult PostHouseDetails(HouseListingViewModel houseListingViewModel)
        {
            IHttpActionResult result;

            HouseListingDTO houseListingDTO = mapHouseListingViewModel2DTO.Map <HouseListingDTO>(houseListingViewModel);

            HouseListingDTO houseListingAdded = houseListingBAL.AddHouseListingBAL(houseListingDTO);

            houseListingViewModel = mapHouseListingDTO2ViewModel.Map <HouseListingViewModel>(houseListingAdded);
            if (houseListingViewModel != null)
            {
                result = Ok(houseListingViewModel);
            }
            else
            {
                result = BadRequest();
            }

            return(result);
        }
        /// <summary>
        /// Posts the House Data to DAC from Controller
        /// </summary>
        /// <param name="houseListingDTO"></param>
        /// <returns></returns>
        public HouseListingDTO AddHouseListingBAL(HouseListingDTO houseListingDTO)
        {
            HouseListingDTO houseListingCreated = houseListingDAC.AddHouseListingDAL(houseListingDTO);

            return(houseListingCreated);
        }
        /// <summary>
        /// Gets the Details of House By unique ID
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public HouseListingDTO GetHouseListingByIdBAL(int id)
        {
            HouseListingDTO houseListingDTO = houseListingDAC.GetHouseListingByIdDAL(id);

            return(houseListingDTO);
        }
Beispiel #9
0
 public HttpResponseMessage Add([FromBody] HouseListingDTO val)
 {
     return(Request.CreateResponse(HttpStatusCode.OK, this.member.Insert(val)));
 }
Beispiel #10
0
 public HouseListing HouseDTOToHouse(HouseListingDTO houselist)
 {
     return(Mapper.Map <HouseListing>(houselist));
 }