Example #1
0
        public ActionResult EditService(int id)
        {
            Common.Entities.Service service = seviceService.GetById(id);

            ServiceViewModel model = new ServiceViewModel(service);

            return(View(model));
        }
Example #2
0
        public ActionResult AddService(int?idService)
        {
            if (idService == null)
            {
                return(HttpNotFound());
            }

            //var user = userService.GetById(User.Identity.GetUserId());

            //var provider = (ProviderProfile)user.UserProfile;

            var provider = userService.FindProviders(m => m.Id == User.Identity.GetUserId()).FirstOrDefault();

            Service service = serviceService.GetById((int)idService);

            if (service == null)
            {
                return(HttpNotFound());
            }

            //if (provider.Services.Any(m => m.Id == idService))
            //{
            //    return HttpNotFound();
            //}

            provider.Services.Add(service);

            userService.UpdateProvider(provider);

            return(RedirectToAction("UserProfile", "Account"));
        }
Example #3
0
        public ActionResult Index(int?serviceId, int?page, string find)
        {
            if (serviceId == null && find == null)
            {
                var allProviders = userService.GetAllProviders();
                ProviderCollectionViewModel providerCollection = new ProviderCollectionViewModel(allProviders);

                ViewBag.Categoryes = new CategoryCollectionViewModel(categoryService.GetAllCategory());

                return(View(providerCollection.ToPagedList(page ?? 1, 10)));
            }
            else if (find != null)
            {
                var findProviders = userService.FindProviders(m => m.Discription.ToLower().Contains(find.ToLower()) ||
                                                              m.FirstName.ToLower().Contains(find.ToLower()) || m.LastName.ToLower().Contains(find.ToLower()));

                ProviderCollectionViewModel providerCollection = new ProviderCollectionViewModel(findProviders);


                ViewBag.Categoryes = new CategoryCollectionViewModel(categoryService.GetAllCategory());

                return(View(providerCollection.ToPagedList(page ?? 1, 10)));
            }
            else
            {
                var service = seviceService.GetById((int)serviceId);

                var profiles = userService.GetAllProviders();

                var searchProfiles = profiles;

                ProviderCollectionViewModel providerCollection = new ProviderCollectionViewModel(searchProfiles);

                ViewBag.Categoryes = new CategoryCollectionViewModel(categoryService.GetAllCategory());

                return(View(providerCollection.ToPagedList(page ?? 1, 10)));
            }
        }