public void UpdateNormalizedTask(NormalizedTask task) { if (task.ID == 0) { context.NormalizedTasks.Add(task); } else { var existEntry = context.Entry<NormalizedTask>(task); existEntry.State = System.Data.Entity.EntityState.Modified; } context.SaveChangesAsync(); }
public AffairViewModel(NormalizedTask task) { if (task == null) { return; } ID = task.ID; Title = task.Title; Description = task.Description; //ExpectedTime = task.ExpectedTime?.ToUniversalTime(); if (task.ExpectedTime.HasValue) { ExpectedTime = DateTime.SpecifyKind(task.ExpectedTime.Value, DateTimeKind.Utc); } }