2
Answers

unauthorized users to access page

Gurjeet Singh

Gurjeet Singh

13y
1.4k
1
I want to protect my few pages from unwanted users. Is I should create that pages in specific folder to protect from unauthorized users. Mostly, I used web.config to protect pages from unauthorized users, is there any other way to protect pages from authorized users.
Answers (2)
1
Naresh Singhal

Naresh Singhal

NA 567 850 7y
Hi , going through your problem, i think you need to use Linq join to retireve data from muliple
 
tables, to use join its very simple  :) 
0
First Last

First Last

NA 35 469 7y
Actually, I resolved this (with help from a great guy) and here is the working action method:
 
It creates a header/multi detail view (not a flattend view which i was intially trying to get).
 
CustomerName CustomerImage OrderDate
   Quantity ProductName, ProductType, ProductImage
CustomerName CustomerImage OrderDate
   Quantity ProductName, ProductType, ProductImage
CustomerName CustomerImage OrderDate
   Quantity ProductName, ProductType, ProductImage 
 
public ActionResult GetCustomerOrdersDetails()
{
// Calls the method to populate the list.
List customerOrders = null;
using (DashboardContext _context = new DashboardContext())
{
customerOrders = _context.OrderSet
.GroupBy(x => new { Name = x.Customer.CustomerName, Image = x.Customer.CustomerImage, Date = x.OrderDate })
.Select(x => new CustomerOrdersViewModel
{
CustomerName = x.Key.Name,
CustomerImage = x.Key.Image,
OrderDate = x.Key.Date,
OrderDetailsViewModel = x.SelectMany(y => y.OrderDetail).Select(y => new OrderDetailsViewModel
{
Quantity = y.Quatity,
ProductType = y.Product.ProductType,
ProductName = y.Product.ProductName,
ProductImage = y.Product.ProductImage
}).ToList()
}).ToList();
}
// Return a partial view.
return PartialView("~/Views/Dashboard/GetCustomerOrdersDetails.cshtml", customerOrders);
}