Posts by pnet • 14,727 points
909 posts
-
0
votes0
answers24
viewsQ: Problems in Mapping with Fluent
I already had a resale table, where I had to add a new field. This new field is a FK of a new table that I created. Then we have: Reseller(Reseller) which receives a FK Discount. In Reseller this…
-
0
votes3
answers59
viewsA: Convert inside a lambda
I resolved it that way: campo1 = (int)campo2;
-
-1
votes3
answers59
viewsQ: Convert inside a lambda
I have a nullable int field and that within a lambda I need to popular a nonnullable property. If I do this: campo1 = Convert.ToInt32(campo2); I take this mistake: Notsupportedexception: LINQ to…
-
3
votes0
answers67
viewsQ: Load information inside the lambda and use in lambda foreach
I created a property in the class CatalogItemResponse to use in a method, but Boss asked to take it. It turns out I need it to load another property and without it I’m not getting it. This is my…
-
0
votes1
answer49
viewsQ: Doubt with virtual properties
I have two tables: A and B On the table A have: Id Nome On the table B have: Id Nome IdA(FK) -> de A In the application would be that? public class A { public int Id { get; set; } public string…
-
-1
votes1
answer36
viewsQ: Table with default value not loaded
I created a table GrupoDesconto, with three fields: Id, Descricao and MargemDesc. On the table Revenda, created a foreign key (Foreign key) GrupoDescontoId who receives the id of GrupoDesconto and…
-
0
votes1
answer100
viewsQ: Virtual property is not instantiated in lambda
When I took a code to improve performance I had the following. A method GetAll() this method populated a var. It was made a foreach in this var and was assigning the appropriate values. It happens…
-
0
votes1
answer73
viewsQ: difficulty making Foreach lambda in a query
I have this query var qry = _productRepository.Table.GroupJoin(_categoriesRepository.Table, p => p.CategoryId, c => c.Id, (p, c) => new { Product = p, Categories = c.DefaultIfEmpty() })…
-
1
votes0
answers23
viewsQ: Return a price list in a VB web service
I have this method within a service(asmx) <WebMethod()> Public Function RetornarPrecoCSP(ByVal CodigoCliente As Long, ByVal CodigoProduto As String, ByVal QtdItem As Long, ByVal TipoVenda As…
-
3
votes1
answer332
viewsA: Switch to lambda/Drum a foreach
I did that and I won a lot. Now you have about 3s to execute, which took more than 2min. var catalogs = _catalogService.GetAllByResellerId(resellerId).Select(c => new MarkupListResponse {…
-
4
votes1
answer332
viewsQ: Switch to lambda/Drum a foreach
I have this method with a foreach inside [Route("")] [HttpGet] [ResponseType(typeof(List<MarkupListResponse>))] public IHttpActionResult Get(int resellerId) { var catalogs =…
-
0
votes2
answers65
viewsQ: How to do a parallelism or asynchronous call in a lambda
I have this query qry.ForEach(q => { var product = new Product(); product.CategoryId = q.CategoryId; product.AuthorizeMaximumPercentageAlteration = q.AuthorizeMaximumPercentageAlteration;…
-
1
votes1
answer45
viewsQ: Help in riding a lambda from a foreach
I have this foreach: foreach (var row in responseObject) { if (row.CDOrigem == request.CentroDeDistribuicaoId) { if (row.FaixasPreco == null || row.FaixasPreco.Count() == 0) { var uniqueItem = new…
-
1
votes1
answer36
viewsQ: Conversion error when trying to popular a variable
I have it: model.Items = new List<CatalogItemResponse>() { qryMode }; gives error because qryMode is of type Catalogitemresponse and not a list of the Catalogitemresponse How to inputo qryMode…
-
1
votes0
answers213
viewsQ: Add new values to an already filled Linq variable
I made that Lambda/Linq: var qry = _productRepository.Table.GroupJoin(_categoriesRepository.Table, p => p.CategoryId, c => c.Id, (p, c) => new { Product = p, Categories = c.DefaultIfEmpty()…
-
1
votes1
answer852
viewsQ: Change framework from a version to a newer one
I have a project .NET(c#) created in Framework 2.0. This Solution contains 11 projects. Now I need to update everything to the Framework 4.7(most recent). What would be my procedure for this? Usage…
-
0
votes1
answer48
viewsQ: I have a panel in aspx, but gives error in code Behind(Web Form)
I took a project in aspx to keep and got this on aspx page <asp:Panel ID="painelTeste" runat="server"> and in code Behind gives error The name painTeste does not exist in the current context.…
-
1
votes1
answer364
viewsQ: Error in the shaman saying that the type was not found
In my shampoo I have: <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"…
-
0
votes0
answers107
viewsQ: When rendering an application in Angular 6 the layout is breaking
I did a job with Angular 6 in a company and I didn’t touch it anymore. I went back to study to actually learn and started with a project I picked up on the internet here. Well, I followed the…
-
1
votes0
answers94
viewsQ: Meaning til before the name of a Class in the class body
I really don’t understand certain things. For example, what does this mean: **~TesteGeral();** public class TesteGeral : IDisposable { public TesteGeral(){string teste, string user } ~TesteGeral();…
-
-2
votes1
answer106
viewsQ: Postman call does not enter the controller constructor with parameter
I took a project already developed, but with several problems. In the controller that I am working on, I put a break in the constructor with a parameter and does not enter. If I define one without…
-
-1
votes1
answer210
viewsQ: Align controls with bootstrap
I have this view @{ ViewBag.Title = "ExcelFinancing"; Layout = "~/Views/Shared/_Layout.cshtml"; } <!DOCTYPE html> <html lang="pt-br"> <head> <meta name="viewport"…
-
1
votes1
answer638
viewsQ: Get value from a view field in a controller
From the answers here, I couldn’t catch it. I have this view @{ ViewBag.Title = "ExcelFinancing"; Layout = "~/Views/Shared/_Layout.cshtml"; } <!DOCTYPE html> <html lang="pt-br">…
-
1
votes0
answers111
viewsQ: Format cell size in . csv files
Gero esse csv public ActionResult geraExcel() { List<vwFinancingReportViewModel> lista = new List<vwFinancingReportViewModel>(); lista = dadosPlanilha(); StringBuilder sb = new…
-
1
votes1
answer61
viewsQ: Download file with mvc is giving dick
I did several searches on the net to find a way to generate a spreadsheet and save to disk. As it comes to web, this can only be done via download, and all the examples searched (at least by me), I…
-
-1
votes1
answer76
viewsQ: Choose folder with mvc c#
How do I allow the user to choose the folder in which to write a sheet? The call will be from an Razor view of mvc.
-
1
votes2
answers89
viewsQ: Rename field in a lambda
In SQL I do so: select campo1 as teste from tabela And in a lambda? How would I do? I have this lambda with several tables and the field ValuePayment is repeated several times. var qry =…
-
0
votes1
answer44
viewsQ: Menu call does not enter Action
I have this menu in _Layout.cshtml @if (Response.Cookies["UserSession"]["UserRole"] == "Rh" || Response.Cookies["UserSession"]["UserRole"] == "Admin") { <li> <a href="#"><i class="fa…
-
1
votes1
answer35
viewsQ: How not to repeat data in this query
I did this query, which will compose a view. SELECT DISTINCT US.EMPLOYEESTATUS ,US.EMPLOYEEID ,US.EMPLOYEEFIRSTNAME + ' ' + US.EMPLOYEEMIDDLENAME + ' ' + US.EMPLOYEELASTNAME AS FULLNAME ,US.GRADE…
-
-1
votes1
answer326
viewsQ: Page cannot be displayed due to internal server error
I’m having this error running the application I only have this, I can’t even put a break point, because it doesn’t even enter the application. I don’t know what to do. This code works on another…
-
-2
votes2
answers507
viewsA: How to place a url on the web.config
I resolved so: public class GetCidadesAsync { HttpClient client = new HttpClient(); string url = ConfigurationManager.AppSettings["serviceApi"]; public async Task<List<Cidade>>…
-
-2
votes2
answers507
viewsQ: How to place a url on the web.config
I have a service that calls this service: public async Task<List<Funcionario>> GetFuncionarios() { string url = $"http://localhost:56137/api/GetFuncionario"; var response = await…
-
0
votes1
answer132
viewsQ: Decimal field displays a . 0 on the screen
I have a CPF field that is decimal(11). Well, when I show on the grid the CPF it looks like this: 12345678911.0, as I can remove the . 0? My Viewmodel public class FuncionarioViewModel { [Key]…
-
-1
votes1
answer48
viewsQ: Edit screen does not load data on screen
When entering edit mode, the Dits should be filled in and only the city dropdownlist comes. See cshtml below. @model TreinamentoCrud.FuncViewModel.FuncionarioViewModel @{ ViewBag.Title = "EditVM"; }…
-
-3
votes1
answer100
viewsQ: How to use a padleft(11) in a get in the API
This is the method I have in my MVC public async Task<List<FuncionarioViewModel>> GetFuncionariosVM() { string url = $"http://localhost:56137/api/GetFuncionario"; var response = await…
-
1
votes2
answers103
viewsQ: Transforms string to decimal within an object
I made a Viewmodel, where in the database the CPF field is decimal(11.0) and in the VM I put as String. In my API the CPF is decimal. Well, when I fill out the field and send the form to the API,…
-
0
votes1
answer148
viewsQ: How to save information(Cpf) from an Edit with mask and a numeric field
In the bank I have the CPF field of type bigint. In the model it is a long. This is what was requested in the requirement. Well, in the model I’ve been using a Datatype.Text to accept the mask, but…
-
-3
votes2
answers615
viewsA: How to put a dropdownlist in a cshtml
public async Task<ActionResult> Create() { GetCidadesAsync cidade = new GetCidadesAsync(); var _cidade = await cidade.GetCidades(); ViewBag.ViewCidade = new SelectList ( _cidade, "id", "nome"…
-
-3
votes2
answers122
viewsQ: Pass Cpf to a javascript function
My field that carries Cpf is this: <div class="form-group"> @Html.LabelFor(model => model.cpf, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10">…
-
0
votes1
answer54
viewsQ: Validate date in editfor
I made a date mask and would like to know, how I validate the date right there, IE, already in Edit he does not accept date like: 23/16/9087. This is my date editfor <div class="form-group">…
-
-4
votes1
answer1594
viewsQ: Put mask to @Html.Editorfor
In the database, the CPF field is bigint and long in the model. I have two problems with this: 1) If Cpf starts with 0 or 00, it will not record this and then, to display on screen, I will have to…
-
-1
votes1
answer35
viewsQ: Show a fk name on the grid
This is the select of my proc select f.id ,f.nome ,f.dataNascimento ,f.cpf ,f.cidade ,c.nome from funcionarios f inner join cidade c on f.cidade = c.id and my model cidae is like this public class…
-
-2
votes1
answer53
viewsQ: Changing the select in SP gives error
That is the mistake: System.Data.Entity.Core.EntityCommandExecutionException: 'The data reader is incompatible with the specified 'TreinamentoCrudApi.Context.Cidade'. A member of the type, 'id',…
-
-5
votes1
answer84
viewsQ: How to bring a city relationship into operation?
I have this model public class Funcionario { [Key] public int id { get; set; } [Required(ErrorMessage ="Nome do funcionário é obrigatório", AllowEmptyStrings =false)] [Display(Name ="Nome")] public…
-
-2
votes2
answers615
viewsQ: How to put a dropdownlist in a cshtml
I need to place a dropdownlist under the following conditions: It will display the name of the City(City Table), but will only record the Employee Code. Using this approach, I can assemble the…
-
1
votes1
answer218
viewsQ: Pass object to proc sql server
Is there any way I can make a SP that receives an object? This is my SP ALTER PROCEDURE [dbo].[sp_alt_funcionarios] -- Add the parameters for the stored procedure here ( @id int, @nome varchar(60)…
-
0
votes1
answer33
viewsQ: When I delete the model name is not shown
I did an action to delete and delete, but View delete does not show the value of the field, which comes from the model. This is cshtml: @model TreinamentoCrud.Models.Cidade @{ ViewBag.Title =…
-
2
votes1
answer107
viewsQ: I’m not getting a list of an API
This URL works on Postman: http://localhost:56137/api/Getcidade. I need now in another MVC project to bring the list of cities. When I do this I catch this mistake: The template item inserted in the…
-
2
votes2
answers202
viewsQ: Model error on Razor page
I have this cshtml @model IEnumerable<TreinamentoCrud.Models.Cidade> @{ ViewBag.Title = "Index"; } <h2>Index</h2> <p> @Html.ActionLink("Create New", "Create") </p>…
-
1
votes0
answers77
viewsQ: Object comes null in query, even if existing
I have this method in my controller [HttpDelete] public HttpResponseMessage DeletaCidade(int id) { Cidade cidade = banco.Cidades.Find(id); if (cidade == null) { return…