A
A
adreSsS2019-07-25 22:02:24
WPF
adreSsS, 2019-07-25 22:02:24

Service (WCF+MS SQL) + Client (WPF App)?

Hello, I am new to desktop applications and when creating a project that consists of a Service (WCF Service Application + MS SQL) and a Client (WPF App), I reached the level where I did everything right, more precisely, I opened my client and it loaded data from the database in the DataGrid and through the methods that I wrote in WCF, it was possible to add, change, update and delete rows in the database. I did it directly in the way that I created several textboxes that binded them to the base columns, I also added 3 buttons (INSERT, UPDATE, DELETE). The first question I have is how it is possible to change the data directly in the DataGrid and so that after pressing the "Save" button, for example, they change in the database. And the second question is how can I improve my UPDATE method so that I do not make an object and write out each of its arguments (all my columns, which I want to update) manually, because there may be more in the future). I am working with Entity Framework. Thank you.
This is what my UPDATE method looks like now:
public void UPDATE (int Day, TimeSpan HourFrom, TimeSpan HourTo)
{
MyEntities db = new MyEntities();
TimeOfWork time = new TimeOfWork();
time.Day = day;
time.HourFrom = HourFrom;
time.HourTo = HourTo;
db.Entry(time).State = Entities.Modified;
db.SaveChanges();
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question