Server Error in '/' Application.

Sequence contains no elements

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Sequence contains no elements

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[InvalidOperationException: Sequence contains no elements]
   System.Linq.Enumerable.First(IEnumerable`1 source) +415
   bonlayn.data.Repositories.ProductCategoryRepository.GetBySlug(String slug) in D:\Vu Ngoc Diep\Changeshop-fullScreen\bonlayn.data\Repositories\ProductCategoryRepository.cs:39
   bonlayn.Controllers.ProductController.DanhMuc(Nullable`1 page, String id, String orderby) in D:\Vu Ngoc Diep\Changeshop-fullScreen\bonlayn\Controllers\ProductController.cs:131
   lambda_method(Closure , ControllerBase , Object[] ) +250
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +280
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
   System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +80
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +453
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +663
   System.Web.Mvc.Controller.ExecuteCore() +144
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +92
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +58
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +22
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +60
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +157


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1586.0