I was facing connection issues with petapoco if I was calling queries separately, so I used QueryMultiple, This is good one.
@0 is indicating parameter what you are passing in QueryMultiple after sql. you can pass multiple parameters (@0, @1, @2, .... so on).
public class Model1
{
public int JobCount { get; set; }
public int JobDate { get; set; }
}
public class Model2
{
public Guid JobId { get; set; }
public string Title { get; set; }
}
public class AppViewModel
{
public Model1 Model1{ get; set; }
public List<Model2> Model2 { get; set; }
}
string sql = @"Select * from table1 where date=@0
Select * from table2 where date=@0";
var result = new AppViewModel();
using (var multi = EntitiesDB.QueryMultiple(sql,
DateTime.Now.DefaultSqlDateTime()))
{
result.Model1 = multi.Read<Model1>().FirstOrDefault();
result.Model2 = multi.Read<Model2>().ToList();
}
public partial class HomeController : UmbracoAuthorizedApiController
Create a API controller which will inherit UmbracoAuthorizedApiController.
[HttpGet]
public object ShowPanel(int linkId) {
Link link = LinkRepository.Current.GetById(linkId);
if (link == null) return Request.CreateResponse(HttpStatusCode.NotFound);
return link;
}
How to create custom module in CMS area with Peta Poco
I have created a customized CMS application in umbraco with petapoco. I am adding all steps to create.
Create Tree Controller
Add this line at last in trees.config.
Add this line in application.config.
You can add this in any position where you want and change the sort order accordingly.
If you want to set this is page as default in CMS then need to modify route.js.
Below post will help to create petapoco tables
https://our.umbraco.org/forum/using-umbraco-and-getting-started/87084-how-to-use-peta-poco
I was facing connection issues with petapoco if I was calling queries separately, so I used QueryMultiple, This is good one.
@0 is indicating parameter what you are passing in QueryMultiple after sql. you can pass multiple parameters (@0, @1, @2, .... so on).
MyApp is custom module so
View path is : App_Plugins/MyApp/BackOffice/Jobs/name.html
Controller path is : App_Plugins/MyApp/BackOffice/Controllers/name.js
We will use Angular Js to call actions.
public partial class HomeController : UmbracoAuthorizedApiController
Create a API controller which will inherit UmbracoAuthorizedApiController.
Dashboard.js
Dashboard.html
Add entry of js file in package.manifest.
is working on a reply...