public List <FullProfileDTO> GetAll() { var skills = skillRepository.GetAll(); return(FullProfileDTO.GetFromSkillList(skills)); }
public FullProfileDTO GetByDeveloperId(int developerId) { var skills = skillRepository.GetByDeveloperId(developerId); return(FullProfileDTO.GetFromSkillList(skills).Single()); }
/// <summary> /// Returns the Full User Profile /// </summary> /// <param name="UserID"></param> /// <returns></returns> public async Task <FullProfileDTO> GetFullProfile(int UserID) { var loginResponse = await _repositoryContext.Login.FirstOrDefaultAsync(a => a.UserID == UserID); var userResponse = await _repositoryContext.User.FirstOrDefaultAsync(a => a.ID == UserID); var businessDetails = await _repositoryContext.Business.FirstOrDefaultAsync(x => x.UserID == userResponse.ID); #region GettingOrdersAndMapping var orderDetails = await _repositoryContext.Order .Where(x => x.BusinessID == businessDetails.ID) .OrderByDescending(m => m.Date) .Take(20).AsNoTracking() .ToListAsync(); var orderListDto = new List <OrderDTO>(); orderListDto.AddRange(orderDetails.Select(order => new OrderDTO { ID = order.ID, Description = order.Description, Date = order.Date.ToString(), InvoiceNumber = order.InvoiceNumber, OrderPlatform = order.OrderPlatform, Discount = order.Discount, Status = order.Status })); #endregion #region GettingTransactionsAndMapping var transactionDetails = await _repositoryContext.Transaction.Where(x => x.BusinessID == businessDetails.ID) .OrderByDescending(m => m.Date) .Take(20).AsNoTracking() .ToListAsync(); var transactionListDto = new List <TransactionDTO>(); transactionListDto.AddRange(transactionDetails.Select(trans => new TransactionDTO { ID = trans.ID, Amount = trans.Amount, Date = trans.Date.ToString(), DebitCredit = trans.DebitCredit, Description = trans.Description, })); #endregion var result = new FullProfileDTO { UserID = loginResponse.UserID, Username = loginResponse.Username, Status = loginResponse.Status, User = new UserBusinessDTO() { ID = userResponse.ID, Lastname = userResponse.Lastname, Firstname = userResponse.Firstname, Birthdate = userResponse.Birthdate, Date_Joined = userResponse.Date_Joined, Email = userResponse.Email, Gender = userResponse.Gender, Business = new BusinessOrderTransactionDTO() { ID = businessDetails.ID, Description = businessDetails.Description, Email = businessDetails.Email, Industry = businessDetails.Industry, Name = businessDetails.Name, Phone = businessDetails.Phone, Order = orderListDto, Transaction = transactionListDto } } }; return(result); }