示例#1
0
        public void Delete(Auto model)
        {
            model.StatusID = 4;

            List <AutoFavorite> favs = model.AutoFavorites.ToList();

            for (int i = 0; i < favs.Count; i++)
            {
                AutoFavoriteService.Delete(favs[i]);
            }

            Edit(model);
            AutoIndexService.DeleteFromIndex(model);
        }
示例#2
0
        public void MoveExpiredAutosToArchives()
        {
            List <Auto> autos = this._repository.GetAny().Where(a => a.StatusID == 2 && a.DateExpires < DateTime.Now).ToList();

            for (int i = 0; i < autos.Count; i++)
            {
                autos[i].StatusID = 3;
                List <AutoFavorite> favs = autos[i].AutoFavorites.ToList();
                for (int j = 0; j < favs.Count; j++)
                {
                    AutoFavoriteService.Delete(favs[j]);
                }
            }

            EditMany(autos);
        }
示例#3
0
        public void MoveToArchives(Auto model, bool movedManually = false)
        {
            model.StatusID = 3;
            model.Top      = 0;

            List <AutoFavorite> favs = model.AutoFavorites.ToList();

            for (int i = 0; i < favs.Count; i++)
            {
                AutoFavoriteService.Delete(favs[i]);
            }

            if (movedManually)
            {
                //cancel scheduled emails concerning this auto
                ScheduledEmailService.CancelScheduledEmails(4, model.ID);
            }

            Edit(model);
        }