Beispiel #1
0
        public static int InsertUserDataItem(UserDataAddRequest model, string UserId)
        {
            var id = 0;

            DataProvider.ExecuteNonQuery(GetConnection, "dbo.UserData_Insert"
                                         , inputParamMapper : delegate(SqlParameterCollection AddUserData)
            {
                AddUserData.AddWithValue("@FirstName", model.FirstName);
                AddUserData.AddWithValue("@LastName", model.LastName);
                AddUserData.AddWithValue("@PhoneNumber", model.PhoneNumber);
                AddUserData.AddWithValue("@UserId", UserId);

                SqlParameter p = new SqlParameter("@Id", System.Data.SqlDbType.Int);
                p.Direction    = System.Data.ParameterDirection.Output;

                AddUserData.Add(p);
            }, returnParameters : delegate(SqlParameterCollection param)
            {
                int.TryParse(param["@Id"].Value.ToString(), out id);
            });
            return(id);
        }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                              ApplicationDbContext context,
                              RoleManager <ApplicationRole> roleManager,
                              UserManager <ApplicationUser> userManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                //this is another routing to completely separated page
                routes.MapRoute(
                    name: "customRoute",
                    template: "customRoute/{controller}/{action}/{id?}");
            });

            AddUserData.Initialize(context, userManager, roleManager).Wait();
        }