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

               return _db.Create<Event>(e);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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;
        }
Exemplo n.º 4
0
        public ActionResult Delete(Event e, int id)
        {
            var res = api.DeleteEvent(e);

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