Portions serving: 4-5 pax
Preparation time: 10 hours for rice to soak.
Cooking time: 30 mins
Ingredients
Rice 1 cup
Water as required
Salt ½ tbsp
Ginger ½ inch
Green chilli 2 pcs
Potato boiled 2 pcs
Suji 2 tbsp
Eno 1 tsp
Onion ½ cup
Carrot grated ½ cup
Capsicum chopped ¼ cup
Coriander chopped 1 tbsp
Oil 2 tbsp
Sesame seeds 1 tbsp
Method
Wash rice and soak it in water overnight.
Then, strain the water and transfer it to a mixer jar.
Add ginger, salt, green chilli, boiled potato and little water. Grind to a smooth batter.
Transfer the batter to the bowl, add suji, eno/fruit salt and mix it.
Then add chopped onions, chopped capsicum, grated carrot, chopped coriander and gently mix it.
Heat a flat pan, add oil, a pinch of sesame seeds and pour the batter over it.
Cover it with a lid and cook it on medium low flame for 1-2 mins.
Once the bottom side of the pancake gets crispy, flip and cook it from the other side.
My Previous post explains how to convert a column to row in JavaScript array. In this post, we will do the same thing but with C# Array and DataTable using the power of LINQ or Lambda expression. For simplicity, I am using the same data.
C# Array To Pivot DataTable:
Here is the C# array object:
var data = new[] {
new { Product = "Product 1", Year = 2009, Sales = 1212 },
new { Product = "Product 2", Year = 2009, Sales = 522 },
new { Product = "Product 1", Year = 2010, Sales = 1337 },
new { Product = "Product 2", Year = 2011, Sales = 711 },
new { Product = "Product 2", Year = 2012, Sales = 2245 },
new { Product = "Product 3", Year = 2012, Sales = 1000 }
};
You might want to get the List<dynamic> or dynamic[] instead of getting DataTable after converting columns to rows. It is handy in ASP.NET Web API to return JSON response.
To do it, I updated the extension method to get the dynamic object. use following extension method:
public static dynamic[] ToPivotArray<T, TColumn, TRow, TData>(
this IEnumerable<T> source,
Func<T, TColumn> columnSelector,
Expression<Func<T, TRow>> rowSelector,
Func<IEnumerable<T>, TData> dataSelector)
{
var arr = new List<object>();
var cols = new List<string>();
String rowName = ((MemberExpression)rowSelector.Body).Member.Name;
var columns = source.Select(columnSelector).Distinct();
cols =(new []{ rowName}).Concat(columns.Select(x=>x.ToString())).ToList();
var rows = source.GroupBy(rowSelector.Compile())
.Select(rowGroup => new
{
Key = rowGroup.Key,
Values = columns.GroupJoin(
rowGroup,
c => c,
r => columnSelector(r),
(c, columnGroup) => dataSelector(columnGroup))
}).ToArray();
foreach (var row in rows)
{
var items = row.Values.Cast<object>().ToList();
items.Insert(0, row.Key);
var obj = GetAnonymousObject(cols, items);
arr.Add(obj);
}
return arr.ToArray();
}
private static dynamic GetAnonymousObject(IEnumerable<string> columns, IEnumerable<object> values)
{
IDictionary<string, object> eo = new ExpandoObject() as IDictionary<string, object>;
int i;
for (i = 0; i < columns.Count(); i++)
{
eo.Add(columns.ElementAt<string>(i), values.ElementAt<object>(i));
}
return eo;
}
ExpandoObject is used to create dynamic object. Now, to convert row to column and get dynamic array:
For treegrid debugging (If we want to see what is the layout file and how the data is structured, call the layout or data directly) http://localhost:5055/Finance/FileTableLayout?ProjectId=99