コード例 #1
0
        public ActionResult Delete(int id)
        {
            try
            {
                service.DeleteSponsor(id);

                return RedirectToAction("Index");
            }
            catch
            {
                var sponsor = service.GetSponsor(id);

                Sponsor model = new Sponsor()
                {
                    ID = sponsor.ID,
                    EventID = sponsor.EventID,
                    Name = sponsor.Name,
                    Description = sponsor.Description,
                    SponsorshipLevel = sponsor.SponsorshipLevel,
                    WebsiteUrl = sponsor.WebsiteUrl,
                    ImageUrl = sponsor.ImageUrl
                };

                return View("Details", model);
            }
        }
コード例 #2
0
        public ActionResult Create(Sponsor sponsor)
        {
            try
            {
                service.CreateSponsor(new CodeCampService.Sponsor()
                {
                    EventID = sponsor.EventID,
                    Name = sponsor.Name,
                    Description = sponsor.Description,
                    SponsorshipLevel = sponsor.SponsorshipLevel,
                    WebsiteUrl = sponsor.WebsiteUrl,
                    Image = ConvertToByes(Request.Files["Logo"])
                });

                return RedirectToAction("Index");
            }
            catch (Exception ex)
            {
                return View(sponsor);
            }
        }
コード例 #3
0
        //
        // GET: /Sponsor/Details/5
        public ActionResult Details(int id)
        {
            var sponsor = service.GetSponsor(id);

            Sponsor model = new Sponsor()
            {
                ID = sponsor.ID,
                EventID = sponsor.EventID,
                Name = sponsor.Name,
                Description = sponsor.Description,
                SponsorshipLevel = sponsor.SponsorshipLevel,
                WebsiteUrl = sponsor.WebsiteUrl,
                ImageUrl = sponsor.ImageUrl
            };

            return View(model);
        }
コード例 #4
0
        public ActionResult Create(int eventid)
        {
            Sponsor model = new Sponsor() { EventID = eventid };

            return View(model);
        }
コード例 #5
0
        public ActionResult Edit(int id)
        {
            var sponsor = service.GetSponsor(id);

            Sponsor model = new Sponsor()
            {
                ID = sponsor.ID,
                EventID = sponsor.EventID,
                Name = sponsor.Name,
                Description = sponsor.Description,
                SponsorshipLevel = sponsor.SponsorshipLevel,
                WebsiteUrl = sponsor.WebsiteUrl,
                Logo = sponsor.Image == null ? null : new Infrastructure.WebImageOCC(sponsor.Image),
            };

            return View(model);
        }