示例#1
0
        public static void Update(_event new_event, long?event_id)
        {
            var _event = context.events.Find(event_id);

            if (_event != null)
            {
                _event.name        = new_event.name;
                _event.type        = new_event.type;
                _event.event_price = new_event.event_price;
                context.SaveChanges();
            }
        }
示例#2
0
        public static long Insert(_event _event)
        {
            var oldEvent = context.events.Where(e => e.name == _event.name).ToList();

            if (oldEvent != null)
            {
                Update(_event, oldEvent[0].id);
                return(oldEvent[0].id);
            }
            context.events.Add(_event);
            return(_event.id);
        }