public ActionResult IndexByName()
 {
     try
     {
         DateTime date1            = new DateTime(2010, 1, 31, 0, 0, 0);
         var      defaultvalue     = _factory.PublicationRepository.Get().FirstOrDefault().PublicationId;
         var      userPublications = UserPublicationService.UserPublicationsWithName(_factory, defaultvalue, date1);
         ViewBag.SumPayed        = UserPublicationService.GetTotalPaidSumForPublication(_factory, defaultvalue, date1);
         ViewBag.AllPublications = _factory.PublicationRepository.Get().OrderBy(o => o.NameOfPublication);
         return(View(userPublications));
     }
     catch (Exception ex)
     {
         logger.Error(ex, ex.Message);
         return(View("Error", new HandleErrorInfo(ex, "UserPublications", "Index1")));
     }
 }
        public ActionResult UserPublicationsSearch(int name, string month, string year)
        {
            try
            {
                int m   = int.Parse(month);
                int y   = int.Parse(year);
                int day = 1;
                switch (m)
                {
                case 1:
                    day = 31;
                    break;

                case 2:
                {
                    if (y == 2016 || y == 2012)
                    {
                        day = 28;
                    }
                    else
                    {
                        day = 28;
                    }
                    break;
                }

                case 3:
                    day = 31;
                    break;

                case 4:
                    day = 30;
                    break;

                case 5:
                    day = 31;
                    break;

                case 6:
                    day = 30;
                    break;

                case 7:
                    day = 31;
                    break;

                case 8:
                    day = 31;
                    break;

                case 9:
                    day = 30;
                    break;

                case 10:
                    day = 31;
                    break;

                case 11:
                    day = 30;
                    break;

                case 12:
                    day = 31;
                    break;

                default:
                    Console.WriteLine("Default case");
                    break;
                }
                DateTime date1            = new DateTime(y, m, day, 0, 0, 0);
                var      userPublications = UserPublicationService.UserPublicationsWithName(_factory, name, date1);
                ViewBag.SumPayed = UserPublicationService.GetTotalPaidSumForPublication(_factory, name, date1);
                if (userPublications.Count <= 0)
                {
                    return(PartialView("SearchUserPError"));
                }

                return(PartialView("AfterSearch", userPublications));
            }
            catch (Exception ex)
            {
                logger.Error(ex, ex.Message);
                return(View("Error", new HandleErrorInfo(ex, "Publications", "PublicationSearch")));
            }
        }