Exemple #1
0
        /// <inheritdoc />
        public async Task <ClientDto> Create(ClientDto request)
        {
            using (var db = new ApplicationDbContext())
            {
                var client = _mapper.ToEntity(request);

                CreateTariffs(request, client);
                await AddNetworkAddresses(request, db);

                var result = await db.Clients.AddAsync(client);

                await db.SaveChangesAsync();

                return(await ById(result.Entity.Id));
            }
        }