Beispiel #1
0
        public Task <bool> Handle(UpdateDeveloperCommand request, CancellationToken cancellationToken)
        {
            if (!request.IsValid())
            {
                NotifyValidationErrors(request);
                return(Task.FromResult(false));
            }

            var model = developerRepository.GetById(request.Id);

            if (model == null)
            {
                bus.RaiseEvent(new DomainNotification(request.MessageType, "This Developer not found."));
                return(Task.FromResult(false));
            }

            model.DescriptionEN = request.DescriptionEN;
            model.DescriptionPT = request.DescriptionPT;
            model.EntityState   = request.EntityState;
            developerRepository.Update(model);

            if (Commit())
            {
                bus.RaiseEvent(new DeveloperUpdatedEvent(model.Id, model.DescriptionPT, model.DescriptionEN, model.EntityState, model.DateCreated));
            }
            return(Task.FromResult(true));
        }
Beispiel #2
0
        public async Task <IActionResult> Details(Guid id)
        {
            var developer = await _developerRepository.GetById(id);

            if (developer == null)
            {
                return(NotFound());
            }

            return(View(developer));
        }
 //GET Developer
 public Developer GetById(int id)
 {
     try
     {
         return(DeveloperRepository.GetById(id));
     }
     catch (RepositoryException ex)
     {
         throw new RepositoryException(ex.Message, ex);
     }
 }
Beispiel #4
0
        public async Task <ActionResult <DeveloperViewModel> > GetById(Guid id)
        {
            var developer = _mapper.Map <DeveloperViewModel>(await _developerRepository.GetById(id));

            if (developer == null)
            {
                return(NotFound());
            }

            return(developer);
        }
Beispiel #5
0
        public ActionResult <Developer> GetDeveloper(int id)
        {
            var entity = _repository.GetById(id);

            if (entity is null)
            {
                return(NotFound($"Entity Developer Id:{id} not found!..."));
            }

            return(entity);
        }
Beispiel #6
0
 public IActionResult GetById(int id)
 {
     try
     {
         var data = _developerRepository.GetById(id);
         if (data == null)
         {
             return(NotFound());
         }
         return(Ok(data));
     }
     catch (Exception ex)
     {
         return(new StatusCodeResult(500));
     }
 }
        internal async Task AddDeslike(string currentUserId, string targetUserId, CancellationToken cancellationToken = default)
        {
            _logger.LogInformation("Adding dislike to {TargetUserId} from {CurrentUserId}", targetUserId, currentUserId);

            var targetUserDb = await _developerRepository.GetById(targetUserId, cancellationToken);

            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            if (targetUserDb.Deslikes == null)
            {
                targetUserDb.Deslikes = new List <string>();
            }
            targetUserDb.Deslikes.Add(currentUserId);

            _ = await _developerRepository.Update(targetUserDb, cancellationToken);
        }
Beispiel #8
0
        public async Task <DeveloperDto> GetAnApplicant(long id)
        {
            var developer = await _developerRepository.GetById(id);

            return(_mapper.Map <DeveloperDto>(developer));
        }
 public DeveloperVM GetById(int id)
 {
     return(mapper.Map <DeveloperVM>(developerRepository.GetById(id)));
 }