public virtual ContactFormListModel PrepareContactFormListModel() { var model = new ContactFormListModel(); //stores model.AvailableStores.Add(new SelectListItem { Text = _localizationService.GetResource("Admin.Common.All"), Value = "" }); foreach (var s in _storeService.GetAllStores()) { model.AvailableStores.Add(new SelectListItem { Text = s.Name, Value = s.Id.ToString() }); } return(model); }
public virtual async Task <ContactFormListModel> PrepareContactFormListModel() { var model = new ContactFormListModel(); //stores model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" }); foreach (var s in await _storeService.GetAllStores()) { model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() }); } return(model); }
public IActionResult ContactFormList(DataSourceRequest command, ContactFormListModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMessageContactForm)) { return(AccessDeniedView()); } DateTime?startDateValue = (model.SearchStartDate == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.SearchStartDate.Value, _dateTimeHelper.CurrentTimeZone); DateTime?endDateValue = (model.SearchEndDate == null) ? null :(DateTime?)_dateTimeHelper.ConvertToUtcTime(model.SearchEndDate.Value, _dateTimeHelper.CurrentTimeZone).AddDays(1); string vendorId = ""; if (_workContext.CurrentVendor != null) { vendorId = _workContext.CurrentVendor.Id; } var contactform = _contactUsService.GetAllContactUs( fromUtc: startDateValue, toUtc: endDateValue, email: model.SearchEmail, storeId: model.StoreId, vendorId: vendorId, pageIndex: command.Page - 1, pageSize: command.PageSize); var gridModel = new DataSourceResult { Data = contactform.Select(x => { var store = _storeService.GetStoreById(x.StoreId); var m = x.ToModel(); m.CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc); m.Enquiry = ""; m.Email = m.FullName + " - " + m.Email; m.Store = store != null ? store.Name : "-empty-"; return(m); }), Total = contactform.TotalCount }; return(Json(gridModel)); }
public IActionResult List() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMessageContactForm)) { return(AccessDeniedView()); } var model = new ContactFormListModel(); //stores model.AvailableStores.Add(new SelectListItem { Text = _localizationService.GetResource("Admin.Common.All"), Value = "" }); foreach (var s in _storeService.GetAllStores()) { model.AvailableStores.Add(new SelectListItem { Text = s.Name, Value = s.Id.ToString() }); } return(View(model)); }
public virtual async Task <(IEnumerable <ContactFormModel> contactFormModel, int totalCount)> PrepareContactFormListModel(ContactFormListModel model, int pageIndex, int pageSize) { DateTime?startDateValue = (model.SearchStartDate == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.SearchStartDate.Value, _dateTimeHelper.CurrentTimeZone); DateTime?endDateValue = (model.SearchEndDate == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.SearchEndDate.Value, _dateTimeHelper.CurrentTimeZone).AddDays(1); string vendorId = ""; if (_workContext.CurrentVendor != null) { vendorId = _workContext.CurrentVendor.Id; } var contactform = await _contactUsService.GetAllContactUs( fromUtc : startDateValue, toUtc : endDateValue, email : model.SearchEmail, storeId : model.StoreId, vendorId : vendorId, pageIndex : pageIndex - 1, pageSize : pageSize); var contactformmodelList = new List <ContactFormModel>(); foreach (var item in contactform) { var store = await _storeService.GetStoreById(item.StoreId); var m = item.ToModel(); m.CreatedOn = _dateTimeHelper.ConvertToUserTime(item.CreatedOnUtc, DateTimeKind.Utc); m.Enquiry = ""; m.Email = m.FullName + " - " + m.Email; m.Store = store != null ? store.Shortcut : "-empty-"; contactformmodelList.Add(m); } return(contactformmodelList, contactform.TotalCount); }
public virtual (IEnumerable <ContactFormModel> contactFormModel, int totalCount) PrepareContactFormListModel(ContactFormListModel model, int pageIndex, int pageSize) { DateTime?startDateValue = (model.SearchStartDate == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.SearchStartDate.Value, _dateTimeHelper.CurrentTimeZone); DateTime?endDateValue = (model.SearchEndDate == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.SearchEndDate.Value, _dateTimeHelper.CurrentTimeZone).AddDays(1); string vendorId = ""; if (_workContext.CurrentVendor != null) { vendorId = _workContext.CurrentVendor.Id; } var contactform = _contactUsService.GetAllContactUs( fromUtc: startDateValue, toUtc: endDateValue, email: model.SearchEmail, storeId: model.StoreId, vendorId: vendorId, pageIndex: pageIndex - 1, pageSize: pageSize); return(contactform.Select(x => { var store = _storeService.GetStoreById(x.StoreId); var m = x.ToModel(); m.CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc); m.Enquiry = ""; m.Email = m.FullName + " - " + m.Email; m.Store = store != null ? store.Name : "-empty-"; return m; }), contactform.TotalCount); }