Esempio n. 1
0
        // Spara data för en borttagen annons
        private async void CopyToRemovedAdv(Advertisement adv)
        {
            ApplicationUser user = await _userManager.FindByIdAsync(adv.MemberId);

            RemovedAdv remAdv = new RemovedAdv();

            remAdv.MemberName  = user.UserName;
            remAdv.AdvTypeId   = adv.AdvTypeId;
            remAdv.Title       = adv.Title;
            remAdv.Description = adv.Description;
            remAdv.Price       = adv.Price;
            remAdv.Place       = adv.Place;
            remAdv.StartDate   = adv.StartDate;
            remAdv.EndDate     = DateTime.Now;

            // Don't copy the Image to Removed Advertisements
            remAdv.ImageFileName = "";

            // Delete the Image File
            DeleteImage(adv.ImageFileName);

            _marketData.CreateRemovedAdv(remAdv);

            var Equipments = _marketData.GetEquipment(adv.Id);

            foreach (var eqm in Equipments)
            {
                CopyToRemovedEqm(eqm, remAdv.Id);
            }
        }