public IEnumerable <B> Get()
        {
            List <B> destination = new List <B>();

            _DBService.Get().ToList().ForEach(delegate(D entity) { destination.Add(ModelMapperService.ManualMap <D, B>(entity)); });
            return(destination);
        }
 public bool AddUser(SignUpModel login)
 {
     login.Password = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(login.Password));
     return(_AuthenticationRepository
            .AddUser(ModelMapperService
                     .Map <SignUpModel, Login>(login)));
 }
示例#3
0
 public List <Company> Search()
 {
     return(_context
            .Companies
            .Select(company => ModelMapperService.MapFromModel(company))
            .ToList());
 }
示例#4
0
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            ExternalToolsService.Init();
            ModelMapperService.Init();
            Commands.Commands.Initialize();
        }
示例#5
0
        public List <UserModel> GetUsers()
        {
            List <UserModel> destination = new List <UserModel>();

            foreach (User user in _UserRepository.GetUsers())
            {
                destination.Add(ModelMapperService.Map <User, UserModel>(user));
            }

            return(destination);
        }
示例#6
0
        public int Create(Company company)
        {
            var newCompany = ModelMapperService.MapToModel(company);

            _context.Companies.Add(newCompany);
            _context.SaveChanges();

            if (newCompany.Id == null)
            {
                throw new Exception("User creation exception.");
            }

            return(newCompany.Id ?? 0);
        }
        public List <RecursiveStack> RecursiveSearch(int companyId)
        {
            return(_context.RecursiveStackModel.FromSqlRaw(
                       @"
WITH RECURSIVE rec(id, name, parent_id, depth, path) AS (
    SELECT S.id, S.name, S.parent_id, 1::INT AS depth, S.id::TEXT AS path FROM stack AS S WHERE S.company_id = {0} AND parent_id IS NULL
    UNION ALL
    SELECT SR.id, SR.name, SR.parent_id, R.depth + 1 AS depth, (R.path || '>' || SR.id::TEXT) FROM rec AS R, stack AS SR WHERE SR.parent_id = R.id
)
SELECT * FROM rec;",
                       companyId
                       )
                   .Select(model => ModelMapperService.MapFromModel(model))
                   .ToList());
        }
 public void Create(Stack stack)
 {
     _context.Stack.Add(ModelMapperService.MapToModel(stack));
     _context.SaveChanges();
 }
 public bool Update(B entity)
 {
     return(_DBService.Update(ModelMapperService.ManualMap <B, D>(entity)));
 }
 public bool Add(B entity)
 {
     return(_DBService.Add(ModelMapperService.ManualMap <B, D>(entity)));
 }
 public B Get(Guid id)
 {
     return(ModelMapperService.ManualMap <D, B>(_DBService.Get(id)));
 }
示例#12
0
 public Company Get(int id)
 {
     return(ModelMapperService.MapFromModel(
                _context.Companies.Select(company => company).First(company => company.Id.Equals(id))
                ));
 }
 public void Create(Address address)
 {
     _context.Address.Add(ModelMapperService.MapToModel(address));
     _context.SaveChanges();
 }
示例#14
0
 public bool UpdateUser(UserModel user)
 {
     return(_UserRepository
            .UpdateUser(ModelMapperService
                        .Map <UserModel, User>(user)));
 }
示例#15
0
 public UserModel GetUser(int id)
 {
     return(ModelMapperService
            .Map <User, UserModel>(
                _UserRepository.GetUser(id)));
 }