Esempio n. 1
0
        public ActionResult Edit(Guid? Id)
        {
            Event Event = new Event
                {
                Start = DateTime.Now.AddDays(10),
                Finish = DateTime.Now.AddDays(10).AddHours(4),
                Source = LevelType.National,
                Distribution = LevelType.National 
                };
            if (Id != null) Event = reposetory.GetEventItem((Guid)Id);
            if (Event == null) return HttpNotFound();

            return View(Event);
        }
Esempio n. 2
0
        public ActionResult Edit(Event Event)
        {
                    
            Event dbEvent = new Event
            {
                Start = DateTime.Now.AddDays(10),
                Finish = DateTime.Now.AddDays(10).AddHours(4),
                Source = LevelType.National,
                Distribution = LevelType.National
            };
            if (Event.EventID != Guid.Empty) dbEvent = reposetory.GetEventItem(Event.EventID);
            if (dbEvent == null) return HttpNotFound();

            if (ModelState.IsValid)
            {
                
                dbEvent.Headline = Event.Headline;
                dbEvent.Description = Event.Description;
                dbEvent.Location = Event.Location;
                dbEvent.IgnorDistribution = Event.IgnorDistribution;
                dbEvent.Distribution = Event.Distribution;
                dbEvent.DistributionLink = Event.DistributionLink;
                dbEvent.Source = Event.Source;
                dbEvent.SourceLink = Event.SourceLink;
                dbEvent.Start = Event.Start;
                dbEvent.Finish = Event.Finish;
                dbEvent.AuthorID = CurrentProfile.PersonID;
                dbEvent.Trim();

                if (reposetory.Save(dbEvent))
                {
                    Event.EventID = dbEvent.EventID;
                    ViewBag.FormSucces = true;
                    ModelState.Clear();
                }
            }




            return View(Event);
        }