public IActionResult DeleteAdministrativeAreaAsync([FromBody] Model.AdministrativeAreaModel model)
        {
            var entity = _mapper.Map <Entity.AdministrativeArea>(model);

            _pimsAdminService.AdministrativeArea.Remove(entity);

            return(new JsonResult(model));
        }
        public IActionResult UpdateAdministrativeAreaAsync([FromBody] Model.AdministrativeAreaModel model)
        {
            var entity = _mapper.Map <Entity.AdministrativeArea>(model);

            try
            {
                _pimsAdminService.AdministrativeArea.Update(entity);

                var adminArea = _mapper.Map <Model.AdministrativeAreaModel>(entity);
                return(new JsonResult(adminArea));
            }
            catch (DbUpdateException ex)
            {
                var duplicateError = ex.CheckErrorMessageForDuplicate("Error while updating Administrative Area.");
                if (duplicateError != null)
                {
                    return(BadRequest(duplicateError));
                }
                throw;
            }
        }
        public IActionResult AddAdministrativeArea([FromBody] Model.AdministrativeAreaModel model)
        {
            var entity = _mapper.Map <Entity.AdministrativeArea>(model);

            try
            {
                _pimsAdminService.AdministrativeArea.Add(entity);

                var administrativeArea = _mapper.Map <Model.AdministrativeAreaModel>(entity);

                return(CreatedAtAction(nameof(GetAdministrativeArea), new { id = administrativeArea.Id },
                                       administrativeArea));
            }
            catch (DbUpdateException ex)
            {
                var duplicateError = ex.CheckErrorMessageForDuplicate("Error while adding Administrative Area.");
                if (duplicateError != null)
                {
                    return(BadRequest(duplicateError));
                }
                throw;
            }
        }