public UserTaskViewModel(UserTask userTask, List<UserTaskTime> userTaskTimelist, IUserTaskService userTaskService,IClientContactService clientContactService) { _userTaskService = userTaskService; _clientContactService = clientContactService; _currentUser = App.CurrentUserProfile; _imagePerStatus = new Dictionary<int, string> { {UserTaskStatus.Active, "iconpause.png"}, {UserTaskStatus.Pending, "iconplay.png"}, {UserTaskStatus.Paused, "iconplay.png"} }; UserTask = userTask; UserTaskTimeList = userTaskTimelist; Duration = UserTask.Status == UserTaskStatus.Aborted ? new TimeSpan(0, 0, (int)UserTask.ElapsedTimeInSeconds): new TimeSpan(0, 0, (int)GetCurrentDuration().Result); if (UserTask.Status == UserTaskStatus.Active) { if (Duration.TotalSeconds > hours24restrictions) { AbortUserTask(); } } if (UserTask.Status == UserTaskStatus.Active) { InitializeTimer(); } BackCommand = new Command(OnBackCommandFired); CanStart = true; }
public async Task<User> SaveUser(User user) { if (GetUserByEmailId(user.EmailId).Result == null) { _dbContext.User.Add(user); } else { _dbContext.User.Update(user); } return await GetUserByEmailId(user.EmailId); }
public async Task<bool> DeleteUser(User user) { _dbContext.User.Delete(user); return await Task.FromResult(true); }
public async Task<User> CreateUser(User user) { _dbContext.User.Add(user); return await GetUserByEmailId(user.EmailId); }
public async Task<User> UpdateUser(User user) { _dbContext.User.Update(user); return await Task.FromResult(user); }