Beispiel #1
0
        public Pool Add(PoolCreationDto model, User user)
        {
            Pool pool = mapper.Map <Pool>(model);

            pool.Users.Add(new UserPoolAssociation
            {
                User = user,
                Pool = pool
            });

            poolRepository.Add(pool);
            poolRepository.SaveChanges();

            return(pool);
        }
Beispiel #2
0
        public JsonResult CreatePool(PoolModel model)
        {
            var pool = Mapper.Map <PoolModel, Pool>(model);

            AddPoolTag(pool, model.Tags);
            if (User.Identity.GetUserId() != null)
            {
                pool.CreatedBy = User.Identity.GetUserId();
            }
            pool.CreatedOn = DateTime.Now;
            pool.IsDeleted = false;
            var toReturn = _poolRepository.Add(pool);

            _unitOfWork.Commit();
            return(Json(new
            {
                IsSuccess = true,
                Data = toReturn
            }));
        }
Beispiel #3
0
        public async Task <int> CreatePool(DateTime closingTime)
        {
            int poolId = await poolRepository.Add(closingTime);

            return(poolId);
        }