Example #1
0
        /// <summary>
        ///  Get an office from its code identifier.
        /// </summary>
        /// <param name="identifier">Identifier of the office</param>
        /// <returns>A single office data</returns>
        public async Task <IOfficeData> GetAsyncOfficeDo(string identifier)
        {
            OfficeDtos data = await _loader.LoadValueAsync(identifier).ConfigureAwait(false);

            IOfficeData office = new Office();

            if (data != null)
            {
                office.Value = data;
                office.Valid = true;
            }
            return(office);
        }
Example #2
0
        /// <summary>
        ///  Get an office from its code identifier.
        /// </summary>
        /// <param name="identifier">Identifier of the office</param>
        /// <returns>A single office data</returns>
        public async Task <IOfficeData> GetDoAsync(string code)
        {
            var data = await _loader.LoadValueAsync(code).ConfigureAwait(false);

            var office = new Office();

            office.Valid = data.IsValid;
            if ((data != null) && (data.IsValid))
            {
                office.Value = data;
            }
            else
            {
                throw new DataLayerException("Invalid office identifier " + code);
            }
            return(office);
        }