Questions tagged as 'c#'

1
answer

How to show data from two tables in C #?

I built a webservice in C #. With a table it was easy to display but what if I have two tables how would I display those data? I did so that's the easiest way: [WebMethod] public String Teste() { SqlConnection Con = null;...
asked by 21.11.2016 / 13:54
1
answer

How to simplify the type declaration with Entity Frameowrk?

I have some tables with several fields of type datetime, and for all of them I need to create a validation in OnModelCreating () for this type, that is, I need to set .HasColumnType("datetime"); , my doubts are; Is there a more practical...
asked by 24.11.2016 / 13:59
1
answer

Method with many if and return

I think my code is very polluted with a lot of if. [ValidateModelAttribute] [HttpPut("{id}")] public IActionResult Put(int id, [FromBody]UserDto model) { try { if (model == null || model.Id != id) return BadRequest(...
asked by 18.11.2016 / 02:51
1
answer

Saving multiple values of an enum in the database

I would like to be able to save several options of an enum (day of the week) something like 1.3.5 (Monday, Wednesday, Friday) As the modeling described here. I created a model public class Horario { [Key] public int ModalidadeProfessor...
asked by 05.10.2016 / 16:13
1
answer

Model / View Programing - WPF and MySQL

I had already done some C ++ programs using the QT framework and its Model / View Programming ( link ). The concept was simple: created a template accessing MySQL Creating the view that accesses the template ... Now that I'm using C...
asked by 21.10.2016 / 00:03
2
answers

Problem with connection between EF and PostgreSQL

I'm trying to make a connection to EF and PostgreSQL in an Asp.Net Mvc application I'm using the following references EntityFramework6.Npgsql Npgsql 3.1 .NET Framework 4.5 I have the following classes: public class Categoria {...
asked by 18.02.2017 / 18:48
1
answer

What to test / implement in a viewmodel?

I'm trying to implement an MVVM (Model - View - Viewmodel) pattern that is related to MVP. Home Since ViewModel, for my understanding, is responsible for "passing" the data from the View layer to the Model, it was the responsibility of doing thi...
asked by 04.07.2016 / 19:11
3
answers

Understand "," as "." when formatting

My Visual Studio is misunderstanding what I type (console): using System; namespace Uri_CSharp { class URI { static void Main(string[] args) { double raio = double.Parse(Console.ReadLine()), area;...
asked by 17.07.2016 / 15:59
1
answer

Keyboard Shortcuts in RibbonWindow

Hello, I'm developing an application using WPF and window based on RibbonWindow from RibbonControlsLibrary and I'm having issues with Gesture from "Ctrl + 0", just with the " Ctrl + NumPad0 "I was able to perform the action through the...
asked by 24.06.2016 / 13:19
1
answer

How to Popular a Listview, and Popular Another Listview by Primary Key?

I have two ListViews that I need to use LINQ to SQL (C #, WPF project) in a search field. When typing in the textbox field the KeyDown event will populate the first ListView (1), as the second has a column that is the Primary Key of the first, I...
asked by 25.06.2016 / 22:14