Example #1
0
        public IActionResult DeleteBuilding(int id, [FromBody] Model.BuildingModel model)
        {
            var entity = _mapper.Map <Entity.Building>(model);

            _pimsService.Building.Remove(entity);

            return(new JsonResult(model));
        }
Example #2
0
        public IActionResult UpdateBuilding(int id, [FromBody] Model.BuildingModel model)
        {
            var entity = _mapper.Map <Entity.Building>(model);

            var updatedEntity = _pimsService.Building.Update(entity);
            var building      = _mapper.Map <Model.BuildingModel>(updatedEntity);

            return(new JsonResult(building));
        }
Example #3
0
        public IActionResult AddBuilding([FromBody] Model.BuildingModel model)
        {
            var entity = _mapper.Map <Entity.Building>(model);

            var addedEntity = _pimsService.Building.Add(entity);
            var building    = _mapper.Map <Model.BuildingModel>(addedEntity);

            return(CreatedAtAction(nameof(GetBuilding), new { id = building.Id }, building));
        }