Esempio n. 1
0
        /// <summary>
        /// Adds a new system
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <GenericIdResponse> AddSystem(AddSystemRequest request)
        {
            if (request == null)
            {
                throw new ValidationException("BlankRequest");
            }
            if (string.IsNullOrWhiteSpace(request.Initials))
            {
                throw new ValidationException("RequiredField", "Initials");
            }
            if (string.IsNullOrWhiteSpace(request.Name))
            {
                throw new ValidationException("RequiredField", "Name");
            }

            R3M_UserManagement_Domain.System newSystem = await _systemService.AddSystem(new R3M_UserManagement_Domain.System
            {
                Initials = request.Initials,
                Name     = request.Name
            });

            return(new GenericIdResponse
            {
                Id = newSystem.Id
            });
        }