Base solution for your next web application

Activities of "otgontugsmiimaa"

I moved interfaces such as IPagedAndSortedInputDto to a new class library and referenced it to all projects. The code below may need someone to call Webapi functions. Thank you.

public static string BASE_URL = "http://localhost:6240";
        public static string GET_PARTS_URL = "api/services/app/part/GetParts";

        public static ListResultOutput<PartDto> GetParts()
        {
            HttpClient client = new HttpClient();
            client.BaseAddress = new Uri(BASE_URL);

            // Add an Accept header for JSON format.
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            string serviceUrl;

            // 2. Get all employees.
            serviceUrl = GET_PARTS_URL;
            AjaxResponse<ListResultOutput<PartDto>> parts = null;
            HttpResponseMessage response = client.PostAsJsonAsync(serviceUrl, new GetPartsInput()).Result;        // Blocking call!
            if (response.IsSuccessStatusCode)
            {
                // Parse the response body. Blocking!
                //parts = response.Content.ReadAsAsync<AjaxResponse<ListResultOutput<PartListDto>>>().Result;
                string s = response.Content.ReadAsStringAsync().Result;
                parts = JsonConvert.DeserializeObject<AjaxResponse<ListResultOutput<PartDto>>>(s);
            }
            else
            {
                throw new Exception(string.Format("{0} {1}", (int)response.StatusCode, response.ReasonPhrase));
            }
            return parts.Result;
        }

The DTOs depend on ASPNETZero interfaces such as IPagedAndSortedInputDto ... If i reference them, there would be no sense separating into class library project.

Yes, it might be a problem. So the solution is to move DTOs to a shared library. Thank you. Some more clarifications on class library please. Do i have to IOrganizationService interface to the class library and leave its implementation in Application project? So i can reuse the interface in client app. By the way, where can i configure URL to hosted app service?

Hi, Halil

An user should login from Windows desktop app and can manage permitted objects. For instance, I want to call IOrganizationUnitAppService.GetOrganizationUnits() function from Windows desktop application.

To accomplish it, I can use JSON to get/post data from/to AppService. In this case, i have to redefine every DTO in client app. But i want to reuse DTOs in which AppService. Is it possible?

I've seen AbpEfConsoleApp sample code. There, i've to put database connection string in app.config. And i don't want to make my database access public.

Thank you

Oh sorry i forgot these.


    <script src="~/api/AbpServiceProxies/GetAll?type=angular&v=@(Clock.Now.Ticks)"></script>
    <script src="~/api/AbpServiceProxies/GetAll?v=@(Clock.Now.Ticks)"></script>
    <script src="~/AbpScripts/GetScripts?v=@(Clock.Now.Ticks)" type="text/javascript"></script>

Hi,

I decided to develope a web which is based on ASP.NET Zero Front end. But i want to use AngularJS to call Application service methods. So i included following refs in FrontEndBundleConfig.cs:

bundles.Add(
                new ScriptBundle("~/Bundles/Frontend/libs/js")
                    .Include(
                        ScriptPaths.Json2,
                        ScriptPaths.JQuery,
                        ScriptPaths.JQuery_Migrate,
                        ScriptPaths.Bootstrap,
                        ScriptPaths.Bootstrap_Hover_Dropdown,
                        ScriptPaths.JQuery_Slimscroll,
                        ScriptPaths.JQuery_BlockUi,
                        ScriptPaths.JQuery_Cookie,
                        ScriptPaths.SpinJs,
                        ScriptPaths.SpinJs_JQuery,
                        ScriptPaths.Angular,
                        ScriptPaths.Angular_Sanitize,
                        ScriptPaths.Angular_Touch,
                        ScriptPaths.Angular_Ui_Router,
                        ScriptPaths.Angular_Ui_Utils,
                        ScriptPaths.Angular_Ui_Bootstrap_Tpls,
                        ScriptPaths.Angular_Ui_Grid,
                        ScriptPaths.Angular_OcLazyLoad,
                        ScriptPaths.Angular_File_Upload,
                        ScriptPaths.Angular_DateRangePicker,
                        ScriptPaths.SweetAlert,
                        ScriptPaths.Toastr,
                        ScriptPaths.MomentJs,
                        ScriptPaths.Abp,
                        ScriptPaths.Abp_JQuery,
                        ScriptPaths.Abp_Toastr,
                        ScriptPaths.Abp_BlockUi,
                        ScriptPaths.Abp_SpinJs,
                        ScriptPaths.Abp_SweetAlert,
                        ScriptPaths.Abp_Angular
                    ).ForceOrdered()
                );

And then added following codes to _Layout.cshtml:

<body class="corporate" ng-app="MyApp" ng-cloak>

Also in /Views/Home/Index.cshtml

@Html.IncludeScript("~/Views/Home/Index.js")

Created a new JS file /Views/Home/Index.js and added following code to it:

(function () {
    'use strict';
    angular
        .module('MyApp', ['ngMaterial', 'abp'])
        .controller('DemoCtrl', ['$scope', 'abp.services.app.carModel', 
    function ($scope, carModelService) {
        var self = this;
        self.carModels = {};

        function init() {
            self.carModels= carModelService.getCarModels({}).success(function (data) {
                self.carModels = data.items;
            }).finally(function () {                
            });
        }

        init();
    }
])
})();

When i run the project following error is thrown: <a class="postlink" href="https://docs.angularjs.org/error/$injector/unpr?p0=abp.services.app.carModelProvider%20%3C-%20abp.services.app.carModel%20%3C-%20DemoCtrl">https://docs.angularjs.org/error/$injec ... 20DemoCtrl</a>

Please help me to find what i did wrong?

That's exactly what i want to hear. Thank you :)

Question

Hi Halil,

There's a case that needs your suggestion. Restaurant(a restaurant is a tenant in my case) staffs are tenant users for adding/updating restaurant informations (such that open hours, menu prices, events, pictures etc.,). All other people are registered as a host user and can search restaurant informations, order a table, comment, rate ...

It seems 'host users' are for 'admin' users. Am i right? But i want to create a new form that registers a user without a tenant. So all users except restaurant staffs are host users and tenants have no users other than staffs. Is it acceptable solution?

Thanks in advance.

Hi there, I'd like to organize an entity which have name and image attributes like:

public class User 
{ 
public string Name{get;set;}; 
public "sometype_for_storing_image" ProfileImage{get;set;}; 
}

I've a input form <input type=text name=Name/> <input type=file name=ProfileImage/>. Then i need to save the form data to the database.

Can "sometype_for_storing_image" be BinaryObject class? If yes what would the DTO, form and JS look like?

I've seen GetProfilePicture, ChangeProfilePicture actions in ProfileController example. But it uses angular fileUploader module. This is non-transactional and i don't want to store bunch of useless images if form data is invalid.

Thanks

Answer

Yes it's on port 80. There is a separate website working on mydomain.com and <a class="postlink" href="http://www.mydomain.com">www.mydomain.com</a> names.

ASP.NETZero demo is located in different folder and different IIS website bound to web1.mydomain.com.

PS: It seems IIS misconfiguration. When i added a binding tenant1.web1.mydomain.com to the IIS website, it worked. Thank you

Showing 1 to 10 of 14 entries