Exemple #1
0
        public async Task <IActionResult> Create(Sector sector)
        {
            if (sector == null)
            {
                return(BadRequest("Sector not passed"));
            }

            var createdSector = await sectorDAO.Create(sector);

            if (createdSector != null)
            {
                return(CreatedAtAction("GetById", "Sector", new { createdSector.Id }, createdSector));
            }
            else
            {
                return(BadRequest("Error occured please try again."));
            }
        }
Exemple #2
0
        public async Task <IActionResult> Create(House house)
        {
            if (house == null)
            {
                return(BadRequest("House not passed"));
            }

            var createdHouse = await houseDAO.Create(house);

            if (createdHouse != null)
            {
                return(CreatedAtAction("GetById", "House", new { createdHouse.Id }, createdHouse));
            }
            else
            {
                return(BadRequest("Error occured please try again."));
            }
        }