Beispiel #1
0
        public Event CreateEvent(Event e)
        {
            e.Modified = DateTime.Now;
            e.UrlShortName = Utility.ToSeoFriendly(e.Name,50);

               return _db.Create<Event>(e);
        }
Beispiel #2
0
        public ActionResult Save(Event e, int id)
        {
            //cannot post if not logged in
            User cur_user = (User)Session["Current_User"];
            e.OwnedBy = cur_user;

            var res = id == 0 ? api.CreateEvent(e) : api.UpdateEvent(e);

            return EventResult(res);
        }
Beispiel #3
0
        public Event UpdateEvent(Event e)
        {
            Event updatedEvent = _db.Retrieve<Event>(e.Id);
            updatedEvent.Name = e.Name;
            updatedEvent.UrlShortName = e.UrlShortName;
            updatedEvent.Details = e.Details;
            updatedEvent.Field1 = e.Field1;
            updatedEvent.Field2 = e.Field2;
            updatedEvent.Field3 = e.Field3;
            updatedEvent.EndDate = Convert.ToDateTime(e.EndDateString);
            updatedEvent.StartDate = Convert.ToDateTime(e.StartDateString);
            updatedEvent.Modified = DateTime.Now;

            if (_db.Update<Event>(updatedEvent) > 0)
                return e;
            return null;
        }
Beispiel #4
0
        public ActionResult Delete(Event e, int id)
        {
            var res = api.DeleteEvent(e);

            return EventResult(res);
        }
Beispiel #5
0
 public Event DeleteEvent(Event e)
 {
     if (_db.Delete<Event>(e) > 0)
         return e;
     return null;
 }