Пример #1
0
        }//end UserList

        public async Task <IActionResult> EditUser(string UserId, string notification)
        {
            string nvm;

            //check if other users want to change 'Admin' deny their access to do that
            var userModifier = await _userManager.FindByNameAsync(User.Identity.Name);

            var userModifierRoleId   = _db.UserRoles.Where(x => x.UserId == userModifier.Id).FirstOrDefault().RoleId;
            var userModifierRoleName = _db.Roles.Where(x => x.Id == userModifierRoleId).FirstOrDefault().Name;

            var userRoleId   = _db.UserRoles.Where(x => x.UserId == UserId).FirstOrDefault().RoleId;
            var userRoleName = _db.Roles.Where(x => x.Id == userRoleId).FirstOrDefault().Name;

            if (userModifierRoleName != "Admin" && userRoleName == "Admin")
            {
                nvm = NotificationHandler.SerializeMessage <string>(NotificationHandler.Access_denied, contentRootPath);
                return(RedirectToAction("UserList", new { notification = nvm }));
            }

            var selectedUser = await _userManager.FindByIdAsync(UserId);

            if (selectedUser != null)
            {
                if (notification != null)
                {
                    ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
                }
                var user = _db.Users.Where(x => x.Id == selectedUser.Id).Include(x => x.UserImage).FirstOrDefault();
                ViewData["selectedUser"] = user;
                return(View());
            }
            nvm = NotificationHandler.SerializeMessage <string>(NotificationHandler.Failed_Update, contentRootPath);
            return(RedirectToAction("Signin", new { notification = nvm }));
        }//end EditUser
Пример #2
0
 public IActionResult Dashboard(string notification)
 {
     if (notification != null)
     {
         ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
     }
     return(View());
 }
Пример #3
0
 //[Route("[action]")]
 public ViewResult Signin(string notification)
 {
     if (notification != null)
     {
         ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
         return(View());
     }
     return(View());
 }//end Signin
Пример #4
0
 public IActionResult SendSms(string smsText, string phoneNumber, string notification)
 {
     if (notification != null)
     {
         ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
         return(View());
     }
     return(View());
 }
Пример #5
0
 public async Task <ViewResult> Signup(string notification)
 {
     if (notification != null)
     {
         ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
     }
     ViewData["Roles"] = _roleManager.Roles.ToList();
     return(View());
 }
 public ViewResult InsertScreenResolution(string notification)
 {
     ViewData["Screen"] = dbScreen.GetAll();
     if (notification != null)
     {
         ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
         return(View());
     }
     return(View());
 }//end InsertScreenResolution
Пример #7
0
 public IActionResult InsertCategory(string notification)
 {
     ViewData["Category"] = dbCategory.GetAll();
     if (notification != null)
     {
         ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
         return(View());
     }
     return(View());
 }
Пример #8
0
 public IActionResult EditFeature(int Id, string notification)
 {
     ViewData["Feature"] = dbAdditionalFeatures.FindById(Id);
     if (notification != null)
     {
         ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
         return(View());
     }
     return(View());
 }
 public IActionResult InsertPost(string notification)
 {
     ViewData["Product"] = dbProductAbstract.GetAll();
     if (notification != null)
     {
         ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
         return(View());
     }
     return(View());
 }
Пример #10
0
        }//end SignupConfirm

        public ViewResult UserList(string notification)
        {
            var users = _db.Users.Include(x => x.UserImage).ToList();

            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
            }
            return(View(users));
        }//end UserList
Пример #11
0
        public IActionResult ShowBanner(string notification)
        {
            var dbViewModel = dbBanner.GetAll();

            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
                return(View(dbViewModel));
            }
            return(View(dbViewModel));
        }
Пример #12
0
 public IActionResult InsertTopBanner(string notification)
 {
     //از کلاس بانک استفاده شده است !!!!
     ViewData["topBanner"] = dbBank.GetAll().LastOrDefault();
     if (notification != null)
     {
         ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
         return(View());
     }
     return(View());
 }
Пример #13
0
        //Product--End
        #endregion
        #region Product Update Count and Price
        //Update Count and Price Of Products -Start
        public IActionResult UpdateProductInfo(string notification)
        {
            var dbViewModel = dbProductAbstract.GetInclude(e => e.Brand, e => e.Category, e => e.ProductImage, e => e.ProductFeature);

            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
                return(View(dbViewModel));
            }
            return(View(dbViewModel));
        }
        }//end InsertScreenResolutionConfirm

        public IActionResult ShowSliders(string notification)
        {
            var model = dbTopSlider.GetInclude(x => x.User).ToList();

            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
                return(View(model));
            }
            return(View(model));
        }
Пример #15
0
        public async Task <IActionResult> UserList(string notification)
        {
            var UsersList = _userManager.Users.ToList();

            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
            }

            return(View(UsersList));
        }
        //Post-Start
        public IActionResult ShowPost(string notification)
        {
            var dbViewModel = dbArticle.GetInclude(e => e.User);

            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
                return(View(dbViewModel));
            }
            return(View(dbViewModel));
        }
Пример #17
0
        public IActionResult ShowGeneralPage(string notification)
        {
            List <GeneralPage> viewModel = dbGeneralPage.GetAll().Where(e => e.Title != "AboutUs").ToList();

            //var viewModel = dbGeneralPage.GetAll() ;
            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
                return(View(viewModel));
            }
            return(View(viewModel));
        }
Пример #18
0
 public ViewResult AddProject(string notification)
 {
     ViewData["CatList"]    = _dbCategory.GetInclude(x => x.Parent).Where(x => x.Status == true).ToList();
     ViewData["SkillsList"] = _dbSkills.GetAll().Where(x => x.Status == true).ToList();
     ViewData["Clients"]    = _dbClient.GetAll().Where(x => x.Status == true).ToList();
     if (notification != null)
     {
         ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
         return(View());
     }
     return(View());
 }//end AddProject
Пример #19
0
        public ViewResult AddCategory(string notification)
        {
            var catList = _dbCategory.GetInclude(x => x.Parent).Where(x => x.Status == true).ToList();

            ViewData["CatList"] = catList;
            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
                return(View());
            }
            return(View());
        }//end AddCategory
Пример #20
0
        public IActionResult Footer(string notification)
        {
            var lastFooterInfo = dbSiteInfo.GetAll().LastOrDefault();

            ViewData["lastFooterInfo"] = lastFooterInfo;
            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
                return(View());
            }
            return(View());
        }
 public ViewResult EditSlider(int Id, string notification)
 {
     ViewData["screen"]         = dbScreen.GetAll();
     ViewData["category"]       = dbCategory.GetAll();
     ViewData["brand"]          = dbBrand.GetAll();
     ViewData["SelectedSlider"] = dbTopSlider.FindById(Id);
     if (notification != null)
     {
         ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
         return(View());
     }
     return(View());
 }
        //public IActionResult ShowPhoto()
        //{
        //    var dbViewModel = dbPhotoGallery.GetInclude(e => e.User);
        //    return View(dbViewModel);
        //}
        //public IActionResult InsertPhoto()
        //{
        //    ViewData["Subject"] = dbSubject.GetAll();
        //    return View();
        //}
        //public IActionResult InsertPhotoConfirm(PhotoGalleryViewModel model)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        byte[] b = new byte[model.Image.Length];
        //        model.Image.OpenReadStream().Read(b, 0, (int)model.Image.Length);
        //        PhotoGallery photoGallery = new PhotoGallery()
        //        {
        //            Name = model.Name,
        //            LatinName = model.LatinName,
        //            Status = model.Status,
        //            Image=b,
        //        };
        //        dbPhotoGallery.Insert(photoGallery);
        //        TempData["InsertConfirm"] = "با موفقیت ثبت شد";
        //        return RedirectToAction("ShowPhoto");
        //    }
        //    return RedirectToAction("InsertPhoto");
        //}
        //public IActionResult DeletePhoto(int Id)
        //{
        //    var status = dbPhotoGallery.DeleteById(Id);
        //    if (status)
        //    {

        //    }
        //    else
        //    {

        //    }
        //    return RedirectToAction("ShowPhoto");
        //}
        //public IActionResult EditPhoto(int Id)
        //{
        //    ViewData["PhotoGallery"] = dbPhotoGallery.FindById(Id);
        //    ViewData["Subject"] = dbSubject.GetAll();

        //    return View();
        //}
        //public IActionResult EditPhotoConfirm(PhotoGalleryViewModel model)
        //{
        //    var entity = dbPhotoGallery.FindById(model.Id);
        //    byte[] b = null;
        //    if (model.Image==null)
        //    {
        //        ModelState.Remove("Image");
        //        b = entity.Image;
        //    }
        //    else
        //    {
        //        b = new byte[model.Image.Length];
        //        model.Image.OpenReadStream().Read(b, 0, (int)model.Image.Length);
        //    }
        //    if (ModelState.IsValid)
        //    {
        //        entity.Name = model.Name;
        //        entity.LatinName = model.LatinName;
        //        entity.Status = model.Status;
        //        entity.SubjectId = model.SubjectId;
        //        entity.Image = b;

        //        dbPhotoGallery.Update(entity);
        //        TempData["InsertConfirm"] = "با موفقیت ثبت شد";
        //        return RedirectToAction("ShowPhoto");
        //    }
        //    return RedirectToAction("InsertPhoto");
        //}
        #endregion
        #region Slider
        public ViewResult InsertSliderImage(string notification)
        {
            ViewData["screen"]   = dbScreen.GetAll();
            ViewData["category"] = dbCategory.GetAll();
            ViewData["brand"]    = dbBrand.GetAll();

            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
                return(View());
            }
            return(View());
        }
Пример #23
0
        //Update Count and Price Of Products -Start
        #endregion
        #region Product Additional Feature
        public IActionResult ShowProductFeature(string notification)
        {
            var dbViewModel = dbProductAbstract.GetInclude(e => e.ProductFeature);

            ViewData["ProductAdditionalFeatures"] = dbProductAdditionalFeatures.GetAll();
            ViewData["AdditionalFeatures"]        = dbAdditionalFeatures.GetAll();
            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
                return(View(dbViewModel));
            }
            return(View(dbViewModel));
        }
Пример #24
0
        public async Task <IActionResult> EditUser(string username, string notification)
        {
            ViewData["Roles"] = _roleManager.Roles.ToList();
            var editUser = await _userManager.FindByNameAsync(username);

            ViewData["EditUser"] = editUser;
            ViewData["UserRole"] = (await _userManager.GetRolesAsync(editUser)).FirstOrDefault();
            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
            }
            return(View());
        }
        public IActionResult ShowPaidPurchuseCart(string notification)
        {
            var dbViewModel = dbInvoice.GetInclude(
                e => e.InvoiceProduct,
                e => e.Customer)
                              .Where(e => e.IsPaid == true).ToList();

            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
                return(View(dbViewModel));
            }
            return(View(dbViewModel));
        }
Пример #26
0
        //Inject DataBase--End
        #endregion

        #region Index
        public IActionResult Index(string notification)
        {
            ViewData[" userManagerCount"]    = userManager.Users.Where(x => x.Status == true).Count();
            ViewData[" ProductFeatureCount"] = dbProductFeature.GetAll().Where(x => x.Status == true).Count();
            ViewData[" CategoryCount"]       = dbCategory.GetAll().Where(x => x.Status == true).Count();
            ViewData[" ContactUsCount"]      = dbContactUs.GetAll().Count();
            ViewData[" ArticleCount"]        = dbArticle.GetAll().Where(x => x.Status == true).Count();
            ViewData[" PaidInvoiceCount"]    = dbInvoice.GetAll().Where(x => x.IsPaid == true).Count();
            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
            }
            return(View());
        }
        public IActionResult ShowNotPaidPurchuseCart(string notification)
        {
            var dbViewModel = dbInvoice.GetInclude(
                e => e.InvoiceProduct,
                e => e.Customer)
                              .Where(e => e.IsPaid == false && e.InvoiceProduct.Count() > 0).ToList();;

            //ViewData["dbInvoiceProduct"] = dbInvoiceProduct.GetInclude(
            //    e => e.ProductFeature,
            //    e => e.ProductFeature.ProductAbstract,
            //    e => e.ProductFeature.ProductAbstract.ProductImage,
            //    e => e.Invoice)
            //    .ToList();
            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
                return(View(dbViewModel));
            }
            return(View(dbViewModel));
        }
Пример #28
0
        public ViewResult ProjectList(string notification, int pageNumber = 1, int pageSize = 25, int filter = 0)
        {
            TempData["currentFilter"] = filter;
            var projects = _dbProject.GetInclude(x => x.Client, y => y.DefinedByUser).Where(x => x.Deleted == false).AsQueryable();

            switch (filter)
            {
            case 0:
                projects = _dbProject.GetInclude(x => x.Client, y => y.DefinedByUser).Where(x => x.Deleted == false).AsQueryable();
                break;

            case 1:
                projects = _dbProject.GetInclude(x => x.Client, y => y.DefinedByUser).Where(x => x.Deleted == true).AsQueryable();
                break;

            case 2:
                projects = _dbProject.GetInclude(x => x.Client, y => y.DefinedByUser).AsQueryable();
                break;

            default:
                projects = _dbProject.GetInclude(x => x.Client, y => y.DefinedByUser).Where(x => x.Deleted == false).AsQueryable();
                break;
            }

            var Result = PagedResult <Projects> .GetPaged(projects, pageNumber, pageSize);

            var finalResult = Result.Results.ToList();

            //Parameters
            ViewData["pagenumber"]   = pageNumber;
            ViewData["pagesize"]     = pageSize;
            ViewData["totalRecords"] = projects.Count();

            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
                return(View(finalResult));
            }
            return(View(finalResult));
        }//end ProjectList
Пример #29
0
        public ViewResult CategoryList(string notification, int pageNumber = 1, int pageSize = 25, int filter = 0)
        {
            TempData["currentFilter"] = filter;
            var catList = _dbCategory.GetInclude(x => x.Parent).Where(x => x.Status == true).AsQueryable();

            switch (filter)
            {
            case 0:
                catList = _dbCategory.GetInclude(x => x.Parent).Where(x => x.Status == true).AsQueryable();
                break;

            case 1:
                catList = _dbCategory.GetInclude(x => x.Parent).Where(x => x.Status == false).AsQueryable();
                break;

            case 2:
                catList = _dbCategory.GetInclude(x => x.Parent).AsQueryable();
                break;

            default:
                catList = _dbCategory.GetInclude(x => x.Parent).Where(x => x.Status == true).AsQueryable();
                break;
            }
            var Result = PagedResult <Category> .GetPaged(catList, pageNumber, pageSize);

            var finalResult = Result.Results.ToList();

            //Parameters
            ViewData["pagenumber"]   = pageNumber;
            ViewData["pagesize"]     = pageSize;
            ViewData["totalRecords"] = catList.Count();

            if (notification != null)
            {
                ViewData["nvm"] = NotificationHandler.DeserializeMessage(notification);
                return(View(finalResult));
            }
            return(View(finalResult));
        }//end CategoryList