示例#1
0
 public static Event Add(DML.Event eventAdd)
 {
     using (IUnitOfWork unitOfWork = new cmiUnitOfWork())
     {
         Repository <Event> repository = new Repository <Event>(unitOfWork);
         eventAdd.UnitState = UnitState.Added;
         Event returnEvent = repository.Create(eventAdd);
         unitOfWork.Commit();
         return(returnEvent);
     }
 }
示例#2
0
        public static bool Update(DML.Event eventUpdate)
        {
            bool successful = false;

            if (eventUpdate == null)
            {
                return(successful);
            }

            using (IUnitOfWork unitOfWork = new cmiUnitOfWork())
            {
                Repository <Event> repository = new Repository <Event>(unitOfWork);
                eventUpdate.UnitState = UnitState.Modified;
                repository.Update(eventUpdate);
                unitOfWork.Commit();
                successful = true;
            }

            return(successful);
        }