Ejemplo n.º 1
0
        public async void UpdateUserInTraining(DAL.App.DTO.UserInTraining userInTraining)
        {
            var usr = await RepoDbSet.FindAsync(userInTraining.Id);

            usr.AttendingTraining = userInTraining.AttendingTraining;
            RepoDbSet.Update(usr);
        }
Ejemplo n.º 2
0
        public async Task <DTO.WorkoutRoutine> ChangeRoutinePublishStatus(Guid routineId, bool isPublished)
        {
            var routineToPublish = await RepoDbSet.FindAsync(routineId);

            routineToPublish.CreatedAt = isPublished ? DateTime.Now : DateTime.MaxValue;
            RepoDbSet.Update(routineToPublish);
            return(Mapper.MapDomainToDAL(routineToPublish));
        }
        public async Task <DAL.App.DTO.Notification> UpdateNotification(DAL.App.DTO.Notification notification)
        {
            var domain = await RepoDbSet.FindAsync(notification.Id);

            domain.Recived = true;
            var addedNotification = RepoDbSet.Update(domain).Entity;

            return(NotificationMapper.Map(addedNotification));
        }
Ejemplo n.º 4
0
        public async Task <DALLoanDTO> FindAsync(int loanId)
        {
            var loan = await RepoDbSet.FindAsync(loanId);

            if (loan == null)
            {
                return(null);
            }
            return(LoanMapper.FromDomain2(loan));
        }
        public async Task <DALReceiptRowDTO> FindAsync(int rowId)
        {
            var row = await RepoDbSet.FindAsync(rowId);

            if (row == null)
            {
                return(null);
            }
            return(ReceiptRowMapper.FromDomain2(row, DateTime.Now));
        }
Ejemplo n.º 6
0
        public async Task <bool> RemoveSoft(int productId)
        {
            var product = await RepoDbSet.FindAsync(productId);

            if (product == null)
            {
                return(false);
            }
            product.IsDeleted = true;
            return(true);
        }
Ejemplo n.º 7
0
        public async Task <bool> RemoveSoft(int changeId)
        {
            var change = await RepoDbSet.FindAsync(changeId);

            if (change == null)
            {
                return(false);
            }
            change.IsDeleted = true;
            return(true);
        }
Ejemplo n.º 8
0
        public async Task <DALOrganizationDTO> FindMinDTOAsync(int id)
        {
            var organization = await RepoDbSet.FindAsync(id);

            if (organization == null || organization.IsDeleted)
            {
                return(null);
            }

            return(OrganizationMapper.FromDomain2(organization));
        }
Ejemplo n.º 9
0
        public async Task ChangeStatusAsync(int loanId, LoanStatus newStatus)
        {
            var loan = await RepoDbSet.FindAsync(loanId);

            if (loan == null)
            {
                throw new NullReferenceException("Didn't find Loan");
            }

            loan.Status = newStatus;
        }
Ejemplo n.º 10
0
        public async Task <bool> SetFinalized(int receiptId)
        {
            var receipt = await RepoDbSet.FindAsync(receiptId);

            if (receipt == null)
            {
                return(false);
            }
            receipt.IsFinalized = true;
            receipt.CreatedTime = DateTime.Now;
            return(true);
        }
Ejemplo n.º 11
0
        public override async Task <LoanRow> FindAsync(params object[] id)
        {
            var loanRow = await RepoDbSet.FindAsync(id);

            if (loanRow != null)
            {
                await RepoDbContext.Entry(loanRow).Reference(l => l.ReceiptRow).LoadAsync();

                await RepoDbContext.Entry(loanRow).Reference(l => l.Loan).LoadAsync();
            }

            return(loanRow);
        }
        public override async Task <ReceiptRow> FindAsync(params object[] id)
        {
            var receiptRow = await RepoDbSet.FindAsync(id);

            if (receiptRow != null)
            {
                await RepoDbContext.Entry(receiptRow).Reference(row => row.Product).LoadAsync();

                await RepoDbContext.Entry(receiptRow).Reference(row => row.Receipt).LoadAsync();
            }

            return(receiptRow);
        }
Ejemplo n.º 13
0
        public override async Task <Price> FindAsync(params object[] id)
        {
            var price = await RepoDbSet.FindAsync(id);

            if (price != null)
            {
                await RepoDbContext.Entry(price).Reference(p => p.Change).LoadAsync();

                await RepoDbContext.Entry(price).Reference(p => p.Product).LoadAsync();
            }

            return(price);
        }
        public override async Task <ReceiptRowChange> FindAsync(params object[] id)
        {
            var rowChange = await RepoDbSet.FindAsync(id);

            if (rowChange != null)
            {
                await RepoDbContext.Entry(rowChange).Reference(rowC => rowC.Change).LoadAsync();

                await RepoDbContext.Entry(rowChange).Reference(rowC => rowC.ReceiptRow).LoadAsync();
            }

            return(rowChange);
        }
Ejemplo n.º 15
0
        public override async Task <ReceiptParticipant> FindAsync(params object[] id)
        {
            var participant = await RepoDbSet.FindAsync(id);

            if (participant != null)
            {
                await RepoDbContext.Entry(participant).Reference(p => p.AppUser).LoadAsync();

                await RepoDbContext.Entry(participant).Reference(p => p.Receipt).LoadAsync();
            }

            return(participant);
        }
Ejemplo n.º 16
0
        public async Task <DALReceiptDTO> FindReceiptAsync(int receiptId)
        {
            var receipt = await RepoDbSet.FindAsync(receiptId);

            if (receipt == null)
            {
                return(null);
            }
            await RepoDbContext.Entry(receipt).Collection(r => r.ReceiptParticipants).LoadAsync();

            await RepoDbContext.Entry(receipt).Reference(r => r.ReceiptManager).LoadAsync();

            return(ReceiptMapper.FromDomain2(receipt));
        }
Ejemplo n.º 17
0
        public override async Task <Loan> FindAsync(params object[] id)
        {
            var loan = await RepoDbSet.FindAsync(id);

            if (loan != null)
            {
                await RepoDbContext.Entry(loan).Reference(l => l.LoanGiver).LoadAsync();

                await RepoDbContext.Entry(loan).Reference(l => l.LoanTaker).LoadAsync();

                await RepoDbContext.Entry(loan).Reference(l => l.ReceiptParticipant).LoadAsync();
            }

            return(loan);
        }
Ejemplo n.º 18
0
        public override async Task <ProductInCategory> FindAsync(params object[] id)
        {
            var productInCategory = await RepoDbSet.FindAsync(id);

            if (productInCategory != null)
            {
                await RepoDbContext.Entry(productInCategory).Reference(obj => obj.Product).LoadAsync();

                await RepoDbContext.Entry(productInCategory).Reference(obj => obj.Category).LoadAsync();

                await RepoDbContext.Entry(productInCategory.Category).Reference(obj => obj.Organization).LoadAsync();
            }

            return(productInCategory);
        }
Ejemplo n.º 19
0
        public async Task <DALLoanRowDTO> FindAsync(int loanRowId)
        {
            var loanRow = await RepoDbSet.FindAsync(loanRowId);

            if (loanRow == null)
            {
                return(null);
            }

            await RepoDbContext.Entry(loanRow).Reference(l => l.Loan).LoadAsync();

            await RepoDbContext.Entry(loanRow.Loan).Reference(l => l.ReceiptParticipant).LoadAsync();

            await RepoDbContext.Entry(loanRow.Loan.ReceiptParticipant).Reference(l => l.Receipt).LoadAsync();

            return(LoanRowMapper.FromDomain(loanRow));
        }
Ejemplo n.º 20
0
        public async Task <DALChangeDTO> EditAsync(DALChangeDTO changeDTO)
        {
            var change = await RepoDbSet.FindAsync(changeDTO.Id);

            if (change == null)
            {
                return(null);
            }

            await RepoDbContext.Entry(change).Reference(c => c.ChangeName).LoadAsync();

            await RepoDbContext.Entry(change.ChangeName).Collection(c => c.Translations).LoadAsync();


            change.ChangeName.SetTranslation(changeDTO.Name);

            return(ChangeMapper.FromDomain(change));
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Edits products name and description, then returns productDTO
        /// </summary>
        /// <param name="dalProductDTO"></param>
        /// <returns></returns>
        public async Task <DALProductDTO> EditAsync(DALProductDTO dalProductDTO)
        {
            var product = await RepoDbSet.FindAsync(dalProductDTO.Id);

            if (product == null)
            {
                return(null);
            }
            await RepoDbContext.Entry(product).Reference(p => p.ProductName).LoadAsync();

            await RepoDbContext.Entry(product.ProductName).Collection(name => name.Translations).LoadAsync();

            await RepoDbContext.Entry(product).Reference(p => p.ProductDescription).LoadAsync();

            await RepoDbContext.Entry(product.ProductDescription).Collection(desc => desc.Translations).LoadAsync();

            product.ProductDescription.SetTranslation(dalProductDTO.Description);
            product.ProductName.SetTranslation(dalProductDTO.Name);

            return(ProductMapper.FromDomain(product));
        }