public void CreateItem(ToDoItemViewModel item) { var user = db.Users.First(u => u.RemoteId == item.UserId); var temp = new Task { IsCompleted = false, IsUploaded = false, Name = item.Name, User = user, RemoteUserId = item.UserId, RemoteTaskId = item.ToDoId }; var tempId = InsertTaskAndGetID(temp); db.SaveChanges(); SyncService.AddToAddQueue(db.Tasks.Single(t => t.Id == tempId)); }
public void CreateItem(ToDoItemViewModel item) { if (item.Name == null || item.Name == string.Empty) { return; } else { var user = db.Users.First(u => u.RemoteId == item.UserId); var temp = new ToDoItem { IsCompleted = false, IsUploaded = false, IsChanged = false, Name = item.Name, User = user, RemoteUserId = item.UserId, RemoteTaskId = item.ToDoId }; var tempId = AddAndGetID(temp); db.SaveChanges(); SyncService.AddToAddQueue(db.Tasks.Single(t => t.Id == tempId)); } }