public async Task <IActionResult> EditSchedule(int?id) { var userName = this.User.Identity.Name; var user = await _userHelper.GetUserByEmailAsync(userName); if (user.IsActive == false) { return(RedirectToAction("EditUser", "Accounts")); } if (id == null) { return(NotFound()); } var activeScheduleId = id.Value; var result = await _activeScheduleRepository.ExistsAsync(activeScheduleId); if (!result) { return(View()); } var scheduleDetail = await _scheduleDetailRepository.GetScheduleDetailAsync(activeScheduleId); var list = await GetDisabledDaysAsync(scheduleDetail.ActiveSchedule.Services.Id, scheduleDetail.Dealership.Id); var services = _servicesSuppliedRepository.GetWithServicesByDealershipId(scheduleDetail.Dealership.Id); var model = _converterHelper.ToEditScheduleViewModel(scheduleDetail, services); var days = Newtonsoft.Json.JsonConvert.SerializeObject(list); model.DaysToDisable = days; model.ActiveScheduleId = activeScheduleId; return(View(model)); }
public async Task <IActionResult> StartRepair(int?Id) { if (Id == null) { return(NotFound()); } var scheduleDetails = await _scheduleDetailRepository.GetScheduleDetailAsync(Id.Value); if (scheduleDetails == null) { return(NotFound()); } var departments = _dealershipDepartmentRepository.GetDealershipDepartments(scheduleDetails.Dealership.Id); var model = _converterHelper.ToStartRepairViewModel(scheduleDetails, departments); return(View(model)); }