/// <summary> /// вывод товаров в личный кабинет компании /// </summary> public IActionResult Articles(string Category, int Page = 1) { var currentUser = _repositoryUser.GetCurrentUser(User.Identity.Name); if (currentUser != null) { var Company = _repositoryCompany.GetUserCompany(currentUser); PagingInfo pagingInfo; var Items = _repositoryArticle.CompanyArticlesFullInformation(Company.Id, Category, Page, out pagingInfo).ToList(); List <ArticleViewModel> ArticlesVM = new List <ArticleViewModel>(); foreach (var item in Items) { var avm = ConstructAVM(item, true); ArticlesVM.Add(avm); } ViewData["Title"] = _settings.ApplicationTitle + "Администрирование: Статьи"; ViewData["HeaderTitle"] = _settings.HeaderTitle; ViewData["FooterTitle"] = _settings.FooterTitle; ViewBag.ArticlesVM = ArticlesVM; ViewBag.PagingInfo = pagingInfo; ViewBag.ActiveSubMenu = "Статьи"; } else { Redirect("/"); } return(View()); }
public IActionResult Goods(GoodStatus goodsStatus = GoodStatus.Active) { var currentUser = _repositoryUser.GetCurrentUser(User.Identity.Name); if (currentUser != null) { var Company = _repositoryCompany.GetUserCompany(currentUser); var Goods = _repositoryGood.ShopGoodsFullInformation(Company.Id).ToList(); List <GoodViewModel> GoodsVM = new List <GoodViewModel>(); foreach (var good in Goods) { GoodViewModel gvm = new GoodViewModel { Amount = good.Amount, Category = good.Category, CategoryId = good.CategoryId, Companies = good.Companies, Description = good.Description, Id = good.Id, Images = good.Images, Title = good.Title }; if (good.Images.Count != 0) { gvm.MainImageInBase64 = FromByteToBase64Converter.GetImageBase64Src(good.Images.ToList()[0]); } GoodsVM.Add(gvm); } ViewBag.GoodsVM = GoodsVM; } else { Redirect("/"); } ViewBag.ActiveSubMenu = "Товары/Услуги"; if (goodsStatus == GoodStatus.Active) { ViewBag.ActiveGoodsStatusMenu = 1; } if (goodsStatus == GoodStatus.InActive) { ViewBag.ActiveGoodsStatusMenu = 0; } return(View()); }
public IActionResult AdminPanel() { var currentUser = _repositoryUser.GetCurrentUser(User.Identity.Name); if (currentUser != null) { var company = _repositoryCompany.GetUserCompany(currentUser); ViewData["Company"] = company; } else { Redirect("/"); } return(View()); }
public IActionResult EditProfile() { ViewBag.ActiveSubMenu = "Профиль"; ViewData["Title"] = _settings.ApplicationTitle + "Администрирование: Статьи"; ViewData["HeaderTitle"] = _settings.HeaderTitle; ViewData["FooterTitle"] = _settings.FooterTitle; var user = _repositoryUser.GetCurrentUser(User.Identity.Name); var Company = _repositoryCompany.GetUserCompany(user); switch (Company.AccountType) { case AccountType.Company: { #region редирект на view для Company var cecvm = new CreateEditCompanyViewModel { Id = Company.Id, Name = Company.Title, ActivityDescription = Company.Description, Email = Company.ContactEmail, Telephone = Company.Telephone }; #region ЗАПИСЬ ИЗОБРАЖЕНИЙ ВО VIEWMODEL if (Company.Images.Count != 0) { cecvm.LogoImageInBase64 = FromByteToBase64Converter.GetImageBase64Src(Company.Images.ToList()[0].Image); foreach (var rci in Company.Images) { //для каждого изображения составляем соответствующую модель отображения cecvm.ImageViewModels.Add( new ImageViewModel { GoodId = rci.CompanyId, Id = rci.ImageId, goodImageIds = rci.CompanyId + "_" + rci.ImageId, ImageMimeType = rci.Image.ImageMimeType, ImageInBase64 = FromByteToBase64Converter.GetImageBase64Src(rci.Image) } ); //для каждого изображения оставляем его id в input всех id изображений товара cecvm.companyImagesIds += rci.ImageId + "_"; } } #endregion return(View("CompanyProfileEditView", cecvm)); #endregion } case AccountType.PrivatePerson: { #region редирект на view для PrivatePerson var cecvm = new CreateEditCompanyViewModel { Name = Company.Title, ActivityDescription = Company.Description, Email = Company.ContactEmail, Telephone = Company.Telephone }; return(View("PrivatePersonProfileEditView", cecvm)); #endregion } default: return(View("PrivatePersonProfileEditView")); } }