Пример #1
0
        public DeveloperDTO Create(DeveloperDTO objet)
        {
            Developer entite   = MapDeveloper.ToEntity(objet, true);
            Developer resultat = _repo.Create(entite);

            objet = MapDeveloperDTO.ToDto(resultat);
            return(objet);
        }
Пример #2
0
        public async Task <IActionResult> Create(Developer developer)
        {
            if (!ModelState.IsValid)
            {
                return(View(developer));
            }

            await _developerRepository.Create(developer);

            return(RedirectToAction("Index"));
        }
        public async Task <CreateUserCmdResponse> Handle(CreateUserCmdRequest request, CancellationToken cancellationToken)
        {
            _logger.LogInformation("executing create user request handler");

            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            var githubResult = await _githubService.GetDeveloper(request.Username, cancellationToken);

            var dbDeveloper = await _developerRepository.Create(githubResult, cancellationToken);

            return(new CreateUserCmdResponse
            {
                Developer = dbDeveloper
            });
        }