Asp.Net mvc Foreach in Divs With different size

@model project titlePortifolio.Models.Projeto

@ {
ViewBag.Title = "DesignDetails";
Layout = "~ / Views / Shared / _LayoutFront.cshtml";

@ Html.DisplayFor (m => m.Title)

Entity Framework – How do I do [Authorize(Roles = “Administrator”)] work in MVC ASP.NET Core

I am preparing an application in ASP.NET Core (Entity Framework) in which I would like to restrict some functions to specific users.

To achieve this in Startu.cs, I add the following code

services.AddDefaultIdentity() .AddRoles 
() .AddEntityFrameworkStores();

Class for creating new default users:

public static class MyIdentityDataInitializer
public static void SeedData (UserManager userManager, RoleManager roleManager)
SeedRoles (roleManager);
SeedUsers (userManager);

public static void SeedUsers (UserManager User manager)
if (userManager.FindByNameAsync (""). Result == null)
IdentityUser user = new IdentityUser ();
user.UserName = "";
user.Email = "";
IdentityResult result = userManager.CreateAsync (user, "Admin1"). Result; // admin1 = password

if (result.Succeeded)
userManager.AddToRoleAsync (user, "Administrator"). Wait (); // Add users to the role


public static void SeedRoles (RoleManager roleManager)
if (! roleManager.RoleExistsAsync ("DefaultUser"). result)
IdentityRole role = new IdentityRole ();
role.Name = "DefaultUser";
IdentityResult roleResult = roleManager.CreateAsync (role) .Result;

if (! roleManager.RoleExistsAsync ("Administrator"). result)
IdentityRole role = new IdentityRole ();
role.Name = "Administrator";
role.NormalizedName = "Administrator";
IdentityResult roleResult = roleManager.CreateAsync (role) .Result;


and in Configure metod I call this class:

MyIdentityDataInitializer.SeedData (userManager, roleManager); 

In control, where I like to restrict activity

 [Authorize(Roles = "Administrator")]
    public IActionResult ConfigurationPortal ()

Now the situation is:
I can check in the database whether users and roles have been created (databases ASPNetUser, ASPNetRoles). There is also a row in the ASPNetUserRoles database where users are assigned as administrators.
I can log in after launching the application, but when I try to open ConfigurationPortal () (or any other restricted method), access restriction information is displayed. It looks like the administrator is not recognized as an administrator.
In the expected situation, if the user is assigned to the role administrator, they can access restricted methods.

Continuous Delivery – Automation of the deployment and backup mechanism of the Asp.Net Web API / Console App

I'm trying to automate the deployment process of the Asp.Net-based API and a console application. I have separate servers and separate TFS code branches for each environment (for example, development, deployment, and production). In essence, these are the steps that I want to automate.

  1. Identify the code check-ins in TFS.
  2. Automated creation
  3. Backup existing files on Windows Server. (with special naming convention for the backup folder)
  4. Provision of the currently created app on Windows Server.

I want to know what tools I can use. What technical approach had to be used to be appropriate and efficient? I use Visual Studio 2017, Azure devOps for Code Repository, Windows Server. Any technical and theoretical instructions are requested. – What is an ideal JavaScript framework / library for a multi-stage standalone application form?

We are an ASP.NET development team that starts with a new stand-alone project. Basically, the project is an extensive multi-stage application form that resembles both the turbo control in the UI and the "questions" like steps. For example, answers to some questions can automatically populate some fields in later steps or completely remove or add later steps later in the application. Form fields are not always your default text box or drop-down box. In some cases, select tiles on a screen, and so on.

Basically, I would like to know which framework best suits our situation and the current state of knowledge of the development team. Please do not simply reply with your preferred framework, I do not want it to become a discussion forum. Please indicate in your answer why this particular JavaScript framework fits our situation for business reasons, etc.

Some information to consider:

That said, we're a .NET team, so it works well with the ASP.NET C # MVC server-side language.
Currently we use ASP.NET MVC with JQuery for our applications
Our team is not very familiar with JavaScript and can easily write server-side code.
We're looking at the following frameworks: VueJS, Angular, React, Blazor (do not worry that the project is in preview mode, in which case Blazor may not start publishing for another 18 months.)
To be honest, I tend to Blazor just because, as I said, most of our staff are unfamiliar with JavaScript, but they are very familiar with Razor. If someone can give me a good reason not to use Blazor and have an alternative, that would be an "acceptable" answer. Please provide me with important business reasons for using a specific framework. I do not want answers such as "Well, everyone is moving toward" responding "as the most popular type of answers, so if you're using our current ASP.NET MVC JQuery solution, let me know as well.

Many Thanks mvc – How to perform complex operations in MVC?

I'm switching from WebForms to MVC (yes, I know I'm very late, but tolerant) and so far have trouble understanding how complex CRUD operations should be performed.

The first limit I've come across is that a view can use only a single model. Then I learned how to use AJAX and call several "action outcomes" as if they were methods in my view. However, this feels like a hack. Every exercise I do does the same: how to use complex logic from the business level? Is the use of Javascript to call post methods in the controller the only way to do this? I feel like I have less control and I am more constrained.

How should you use complex logic from the business layer? – Add a function to an ASP tag

I want to call a function in an ASP tag. The code is:

<< Primera

I tried the following:

<< <% Traduce(Primera) %>

The displayed error is:

Traduce is not declared. The access may not be possible due to the protection level.

Traduce is a method that was created in a Visual Basic file and works correctly.

How can I call the method in ASP code?

Many Thanks mvc – Addressing questions about multiple servers

Full Disclosure: I've been a .NET developer for several years, but have never worked on deployment. So far, I've only deployed IIS locally (single instance) to test developers. I did not have a chance to participate in multi-server deployments, including load balancing, load testing, stress testing, etc. This remains a dark area and a weak point when I conduct an interview and I want to correct that situation.

In two recent interviews I was asked the following questions:

(1) In a distributed ASP.NET MVC system, the logon request of a user is serviced by server 1. He is logged in. Because HTTP is stateless, the server has completed its request response and closed the connection. His subsequent request from the homepage hits server 2.
How can Server 2 detect if the user is already logged in? How do server authentication information communicate?

(2) How do you achieve a transaction / rollback in a distributed architecture? For example, suppose you have a resource that needs to be written in part to 2 servers. You provide two asynchronous HTTP POST requests with the appropriate data to each server. On server 1, writing is successful. on server 2, the write fails. How's it going?
Are you putting the writing back on Server 1? Are you trying to save to Server 2 again? How do you achieve this?

It would be nice if you could answer these questions. But more importantly, I'm looking for resources on these topics.
Where do I have to search and how can I answer such questions? mvc – How to Improve the Performance of a Simple Injector

I'm trying to paste 10Lack records at the same time, but it takes 5 minutes to improve performance.
A simple injector is the fastest container, but I have not found out that it is the fastest container.
This My Code:


                                                        public ActionResult Create (FormCollection Collection)
Customer employee = new customer ();
for (int i = 1; i <= 1000000; i ++)
employee.FirstName = collection["Name"] = "newride";
employee.LastName = collection["City"] = "m";
employee.address = collection["Address"] = "USA";
CustomerRepository employeeBusinessLayer = new CustomerRepository ();
employeeBusinessLayer.Add (employee);
return view ("index");


                                                                                        public customer add (customer article)
using (SqlConnection con = new SqlConnection (connection string))
{SqlCommand cmd = new SqlCommand ("spAddEmployee", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter paramName = new SqlParameter ();
paramName.ParameterName = "@FirstName";
paramName.Value = item.FirstName;
cmd.Parameters.Add (paramName);
SqlParameter paramlast = new SqlParameter ();
paramlast.ParameterName = "@LastName";
paramlast.Value = item.LastName;
cmd.Parameters.Add (paramlast);
SqlParameter paramAddress = new SqlParameter ();
paramAddress.ParameterName = "@Address";
paramAddress.Value = item.Address;
cmd.Parameters.Add (paramAddress);
con.Open ();
cmd.ExecuteNonQuery ();
Return item;


                                                                    public class MvcApplication: System.Web.HttpApplication
Protected Void Application_Start ()
SimpleInjectorConfig.RegisterComponents ();
var container = new container ();
container.RegisterMvcControllers (Assembly.GetExecutingAssembly ());
DependencyResolver.SetResolver (
new SimpleInjectorDependencyResolver (container);

How can the performance be improved and how can the above code be changed?