// GET: ChooseAppointment/Edit/5 public async Task <IActionResult> Edit(int?id, string storeId, string selectedDate) { if (TempData["message"] != null) { ViewData["message"] = TempData["message"]; } if (id == null) { return(NotFound()); } int sId = int.Parse(storeId); // this is the location id... DateTime datSelectedDate = DateTime.Now.ToLocalTime(); try { var ddatSelectedDate = DateTime.Parse(selectedDate, CultureInfo.GetCultureInfo("de-DE")); datSelectedDate = ddatSelectedDate; } catch (Exception e) { return(Json("false")); } int userId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); var tbUser = await _context.TblUsers.AsNoTracking().FirstOrDefaultAsync(a => a.Id == userId); RestAccess ra = new RestAccess(tbUser.Id.ToString(), tbUser.RestPasswort, Constants.ServiceClientEndPointWithApiPrefix); var shop = await ra.GetMeetingsForDate(sId, datSelectedDate.Date.AddHours(2)); var slots = shop.Result.Where(a => a.Id == -1).ToList(); List <AppointmentEntryViewModel> lstAppointmentEntryViewModels = new List <AppointmentEntryViewModel>(); var exMeeting = slots[id.Value - 1]; AppointmentEntryViewModel vm = new AppointmentEntryViewModel(); vm.Id = 0; vm.EmployeeName = exMeeting.Staff.Name; vm.EndTime = exMeeting.End; vm.OptionalText = ""; var res = await ra.GetDefaultText(exMeeting.Staff.Id); if (res != null && res.Result != null) { vm.PreviewText = res.Result.PlaceholderText; } else { vm.PreviewText = ""; } vm.ShopId = sId; vm.StaffId = exMeeting.Staff.Id; vm.StartTime = exMeeting.Start; return(View(vm)); }