示例#1
0
        public ServiceIndexViewModel GetIndexPageInformation(string typeService, string customer, IDataProtector protector, Guid idAccount)
        {
            var idTypeService = Guid.Empty;
            var idCustomer    = Guid.Empty;

            if (!string.IsNullOrEmpty(typeService))
            {
                idTypeService = Guid.Parse(protector.Unprotect(typeService));
            }

            if (!string.IsNullOrEmpty(customer))
            {
                idCustomer = Guid.Parse(protector.Unprotect(customer));
            }

            var model = new ServiceIndexViewModel
            {
                TypeServicesList = _typeServiceDao.GetAll()
                                   .Select(
                    t =>
                    new TypeServiceListViewModel()
                {
                    Id   = protector.Protect(t.Id.ToString()),
                    Name = t.Name
                })
                                   .ToList(),
                Customers =
                    _customerDao.GetCustomerByTypeService(idTypeService, idAccount)
                    .Select(
                        c =>
                        new ServiceCustomerViewModel()
                {
                    Id            = protector.Protect(c.Id.ToString()),
                    Name          = c.Name,
                    IdTypeService = typeService
                })
                    .ToList(),
                Services =
                    _serviceDao.GetServicesByCustomerId(idAccount, idCustomer)
                    .Select(
                        s =>
                        new ServiceItemViewModel()
                {
                    Id             = protector.Protect(s.Id.ToString()),
                    Name           = s.Name,
                    IdCustomer     = customer,
                    IdTypeBusiness = typeService,
                    Icon           = s.Icon,
                    IconColor      = s.IconColor
                })
                    .ToList()
            };


            return(model);
        }
示例#2
0
 /// <summary>
 /// Dame Tipo de Servicios
 /// </summary>
 /// <returns></returns>
 public List <TypeService> GetAll()
 {
     return(_typeServiceDao.GetAll());
 }