public BLResponse<Author> GetAuthors(BLRequest blRequest){

			return Client.Execute(proxy=>{
				var u= Authors.Get(proxy);
				var r = new BLResponse<Author>();
				if(!IsCayita(blRequest)) 
					r.Result=u;
				else
				{
					HtmlDiv div = new HtmlDiv( ){Name="Author"};

					var itag = new HtmlIcon(){
						Class="button-add icon-plus-sign",
						Name="Author"
					};

					div.AddHtmlTag(itag);

					div.AddHtmlTag(BuildAuthorGrid(u));

					HtmlDiv formDiv = new HtmlDiv(){Id="div-form-edit"};
					formDiv.Style.Hidden=true;

					var form = BuildAuthorForm();
					form.AddCssClass("span6");
					form.Title="Author's Data";
					formDiv.AddHtmlTag(form);
				
					r.Html= div.ToString()+formDiv.ToString();

				}
				return r;
			});
		}
		public BLResponse<Sale> SendSalesRepo(SendSales request, BLRequest blRequest){

			var res = new BLResponse<Sale>();

			var mailTarget = request.Email; //MailTarget(blRequest);

			var sales = GetSalesFromRepo(request, blRequest);

			var gsbv = (from g in sales group g by g.Vendor into r 
			select new SalesByVendor {
				Vendor=  r.Key, 
				Total= r.Sum(p=>p.Price)
			}).OrderByDescending(f=>f.Total).ToList();

			HtmlDiv div = new HtmlDiv();

			var gridSalesByVendor =BuildSalesByVendorGrid(gsbv, mailTarget);

			div.AddHtmlTag(gridSalesByVendor);
			div.AddHtmlTag( new HtmlLineBreak());

			foreach(var sv in gsbv ){
				div.AddHtmlTag(( BuildDetails(sv.Vendor, sales.Where(f=>f.Vendor== sv.Vendor).ToList(), mailTarget)));
				div.AddHtmlTag( new HtmlLineBreak());
			}

			if(mailTarget.IsNullOrEmpty()){
				res.Html= div.ToString();
				return res;
			}

			SendSalesRepoByMail(div, mailTarget);
			return res;
		}
		HtmlGrid<Author> BuildAuthorGrid (List<Author> users){

			var grid = new HtmlGrid<Author>(){Name="Author"};
			grid.DataSource= users;
			grid.Css = new Bootstrap();

			grid.AddGridColum( c=> {
				c.CellRenderFunc=(row,index,dt)=> row.Id;
				c.HeaderText="Id";
				c.Hidden=true; 
			});

			grid.AddGridColum( c=> {
				c.CellRenderFunc= (row,index,dt)=> row.Name;
				c.HeaderText="Name";
			});

			grid.AddGridColum( c=> {
				c.HeaderText="City";
				c.CellRenderFunc=(row,index,dt)=> row.City;
			});

			grid.AddGridColum( c=> {
				c.CellRenderFunc= (row,index,dt)=> row.Comments;
				c.HeaderText="Comments";
			});

			grid.AddGridColum( c=> {
				c.HeaderText="Active?";
				c.CellRenderFunc=(row,index,dt)=> {
					dt.Parent.Style.Color=row.Active?"black":"grey";
					var itag = new HtmlIcon(){
						Class= row.Active? "icon-ok-circle":"icon-ban-circle",
					};
					return itag;
				};
				c.CellStyle.TextAlign="center";
			});


			grid.AddGridColum( c=> {
				c.HeaderText="";
				c.CellStyle.Width=new WidthProperty(){Unit="%",Value=10};
				c.CellRenderFunc=(row,index,dt)=>{
					var idiv = new HtmlDiv();
					var itag = new HtmlIcon(){
						Name="Author",
						Class="button-edit icon-edit",
						Url= "api/Author/read/{0}".Fmt( row.Id)
					};
					itag.Style.Margin.Left=5;
					idiv.AddHtmlTag(itag);

					itag = new HtmlIcon(){
						Class="button-delete icon-remove",
						Url= "api/Author/destroy/{0}".Fmt( row.Id)
					};
					itag.Style.Margin.Left=5;
					itag.Style.Color="red";
					idiv.AddHtmlTag(itag);
					return idiv;
				};
			});

			return grid;
		}
		HtmlGrid<User> BuildUserGrid (List<User> users){

			var grid = new HtmlGrid<User>(){Name="User"};
			grid.DataSource= users;
			grid.Css = new Bootstrap();

			grid.AddGridColum( c=> {
				c.CellRenderFunc=(row,index,dt)=> row.Id;
				c.HeaderText="Id";
				c.Hidden=true; 
			});

			grid.AddGridColum( c=> {
				c.CellRenderFunc= (row,index,dt)=> row.Name;
				c.HeaderText="Name";
			});

			grid.AddGridColum( c=> {
				c.HeaderText="City";
				c.CellRenderFunc=(row,index,dt)=> row.City;
			});

			grid.AddGridColum( c=> {
				c.CellRenderFunc= (row,index,dt)=> row.Address;
				c.HeaderText="Address";
			});

			grid.AddGridColum( c=> {
				c.HeaderText="Birthday";
				c.CellRenderFunc=(row,index,dt)=> row.DoB.Format("MM/dd/yyy");
				c.CellStyle.TextAlign="center";
			});

			grid.AddGridColum( c=> {
				c.HeaderText="E-Mail";
				c.CellRenderFunc=(row,index,dt)=> row.Email;
			});

			grid.AddGridColum( c=> {
				c.HeaderText="Rating";
				c.CellRenderFunc=(row,index,dt)=>{ 
					dt.Parent.AddCssClass(row.Rating==10?"success":row.Rating<6?"warning":"" );
					return row.Rating;
				};
				c.CellStyle.TextAlign="center";
			});

			grid.AddGridColum( c=> {
				c.HeaderText="Level";
				c.CellRenderFunc=(row,index,dt)=> {
					c.CellStyle.Color= row.Level=="A"?"green": row.Level=="B"?"orange":"red";
					return row.Level;
				};
				c.CellStyle.TextAlign="center";

			});

			grid.AddGridColum( c=> {
				c.HeaderText="Active?";
				c.CellRenderFunc=(row,index,dt)=> {
					dt.Parent.Style.Color=row.IsActive?"black":"grey";
					//return row.IsActive.Format();
					var itag = new HtmlIcon(){
						Class= row.IsActive? "icon-ok-circle":"icon-ban-circle",
					};
					return itag;
				};
				c.CellStyle.TextAlign="center";
			});


			grid.AddGridColum( c=> {
				c.HeaderText="";
				c.CellStyle.Width=new WidthProperty(){Unit="%",Value=10};
				c.CellRenderFunc=(row,index,dt)=>{
					var idiv = new HtmlDiv();
					var itag = new HtmlIcon(){
						Name="User",
						Class="button-edit icon-edit",
						Url= "api/User/read/{0}".Fmt( row.Id)
					};

					itag.Style.Margin.Left= 5;
					idiv.AddHtmlTag(itag);

					itag = new HtmlIcon(){
						Class="button-delete icon-remove",
						Url= "api/User/destroy/{0}".Fmt( row.Id)
					};
					itag.Style.Margin.Left= 5;
					itag.Style.Color="red";

					idiv.AddHtmlTag(itag);
					return idiv;
				};
			});

			return grid;
		}