public ActionResult Edit(HomeBoxItem homeBoxItem, int homeBoxID)
        {
            try
            {
                var files = Utilities.SaveFiles(Request.Files, Utilities.GetNormalFileName(homeBoxItem.Title), StaticPaths.HomeBoxItems);

                if (files.Count > 0)
                {
                    homeBoxItem.Filename = files[0].Title;
                }

                homeBoxItem.LastUpdate = DateTime.Now;

                ViewBag.Success = true;

                if (homeBoxItem.ID == -1)
                {
                    homeBoxItem.HomeBoxID = homeBoxID;
                    HomeBoxItems.Insert(homeBoxItem);

                    UserNotifications.Send(UserID, String.Format("جدید - عکس باکس های صفحه نخست '{0}'", homeBoxItem.Title), "/Admin/HomeBoxItems/Edit/" + homeBoxItem.ID, NotificationType.Success);
                    homeBoxItem = new HomeBoxItem();
                }
                else
                {
                    HomeBoxItems.Update(homeBoxItem);
                }
            }
            catch (Exception ex)
            {
                SetErrors(ex);
            }

            return(ClearView(homeBoxItem));
        }
        public ActionResult Edit(int?id)
        {
            HomeBoxItem homeBoxItem;

            if (id.HasValue)
            {
                homeBoxItem = HomeBoxItems.GetByID(id.Value);
            }
            else
            {
                homeBoxItem = new HomeBoxItem();
            }

            return(View(homeBoxItem));
        }