Ejemplo n.º 1
0
        public async Task <User> CreateAsync([FromBody] User user)
        {
            user.Id = 0;
            await usersRepository.SaveAsync(user).ConfigureAwait(false);

            return(user);
        }
Ejemplo n.º 2
0
        public async Task <EntityResponse> CreateAsync(CreateEntityCommand createCommand)
        {
            _createCommandValidator.ValidateAndThrowIfFailed(createCommand);

            var entity       = _mapper.Map <CreateEntityCommand, Entity>(createCommand);
            var createdEntiy = await _entitiesRepository.SaveAsync(entity);

            return(_mapper.Map <Entity, EntityResponse>(createdEntiy));
        }
Ejemplo n.º 3
0
        public async Task <UserTask> Add(int userId, [FromBody] UserTask userTask)
        {
            User user = await usersRepository.GetAsync(userId).ConfigureAwait(false);

            user.AddTask(userTask);
            await tasksRepository.SaveAsync(userTask).ConfigureAwait(false);

            return(userTask);
        }