Ejemplo n.º 1
0
        public IActionResult Add([FromBody] HouseDto house)
        {
            var entity   = mapper.Map <House>(house);
            var newHouse = houseRepository.Create(entity);
            var result   = mapper.Map <HouseDto>(newHouse);

            return(Ok(result));
        }
Ejemplo n.º 2
0
        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                var house = new Models.House
                {
                    Id                = Guid.NewGuid(),
                    Object            = this.House.Object,
                    ObjectDescription = this.House.ObjectDescription,
                    Longitude         = this.House.Longitude,
                    Latitude          = this.House.Latitude
                };

                _houseRepository.Create(house);
                return(RedirectToPage("/House/HouseList"));
            }

            return(Page());
        }
Ejemplo n.º 3
0
 public async Task <House> Create(House model)
 {
     model.PostedAt  = DateTime.Now;
     model.IsSelling = true;
     return(await _houses.Create(model));
 }
Ejemplo n.º 4
0
 public ActionResult Post([FromBody] House house)
 {
     repository.Create(house);
     return(Ok(house));
 }