12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using WpfApp29.Models;
- namespace WpfApp29.ViewModels
- {
- class TaskCreatorUserControlViewModel : BaseTaskUserControlViewModel
- {
- public TaskCreatorUserControlViewModel() { }
- public TaskCreatorUserControlViewModel(Task task) : base(task) { }
- public RelayCommand? _commandRemoveTask;
- public RelayCommand? CommandRemoveTask
- {
- get
- {
- return _commandRemoveTask ??= new RelayCommand(
- x =>
- {
- MainContext ctx = new MainContext();
- var task = ctx.Tasks.First(t => Task.Id == t.Id);
- task.StatusId = 4;
- ctx.SaveChanges();
- });
- }
- }
- public RelayCommand? _commandSetDoneTask;
- public RelayCommand? CommandSetDoneTask
- {
- get
- {
- return _commandSetDoneTask ??= new RelayCommand(
- x =>
- {
- MainContext ctx = new MainContext();
- ctx.Tasks.ToList().First(t => Task.Id == t.Id).StatusId = 3;
- ctx.SaveChanges();
- });
- }
- }
- }
- }
|