0

The following @Html.ActionLink() works intermittently. I'm not sure why this is happening.

Controller:

[HttpPost]
public ActionResult ServiceSchedules(string businessName, string serviceName, DateTime serviceScheduleStart, DateTime serviceScheduleEnd)
{
    if (ModelState.IsValid)
    {
        if (businessName == null || serviceName == null || serviceScheduleStart == null || serviceScheduleEnd == null)
        {
            return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        }
        try
        {
            return View(_serviceManager.AddClientSchedule(businessName, serviceName, serviceScheduleStart, serviceScheduleEnd));
        }
        catch (Exception)
        {
            return View();
        }
    }
    return View();
}

ActionLink:

@Html.ActionLink(
  linkText: "Select date/time slot",
  actionName: "ServiceSchedules",
  controllerName: "Services",
  routeValues: new {
      businessName = item.BusinessName,
      serviceName = item.ServiceName,
      serviceScheduleStart = item.ServiceScheduleStart,
      serviceScheduleEnd = item.ServiceScheduleEnd
  },
  htmlAttributes: null)

Any help would be greatly appreciated. Thank you!

Zach Hutchins
  • 801
  • 1
  • 12
  • 16
Thomas Stout
  • 503
  • 1
  • 4
  • 8

0 Answers0