public KanbanSystemContextRepository()
 {
     context             = ContextHelper.KanbanSystemContext;
     boardInteraction    = new BoardInteraction(context);
     boardManager        = new BoardManager(context);
     cardListInteraction = new CardListInteraction(context);
     cardManager         = new CardManager(context);
     userManager         = new UserManager(context);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Updates in <paramref name="context"/> an <paramref name="oldEntity"/> with values from <paramref name="newEntity"/>
        /// </summary>
        /// <param name="context">Context to work in</param>
        /// <param name="oldEntity">Old entity</param>
        /// <param name="newEntity">New entity from where to set values</param>
        /// <returns></returns>
        public static T UpdateEntity(KanbanSystemContext context, T oldEntity, T newEntity)
        {
            context.Entry(oldEntity).State = EntityState.Detached;
            var    type       = oldEntity.GetType();
            var    properties = type.GetProperties();
            object propValue  = null;
            var    propName   = "";

            foreach (var p in properties)
            {
                for (int i = 0; i < properties.Length; i++)
                {
                    propName = properties[i].Name;
                    if (i == 0 && propName.Contains("Id"))
                    {
                        continue;
                    }
                    propValue = type.GetProperty(propName).GetValue(newEntity);
                    properties[i].SetValue(oldEntity, propValue);
                }
            }
            context.Entry(oldEntity).State = EntityState.Modified;
            return(oldEntity);
        }
Exemplo n.º 3
0
 public BoardManager(KanbanSystemContext context) : base(context)
 {
 }
Exemplo n.º 4
0
 public CardListInteraction(KanbanSystemContext _context)
 {
     context = _context;
 }
Exemplo n.º 5
0
 public BoardInteraction(KanbanSystemContext _context)
 {
     context = _context;
 }
Exemplo n.º 6
0
 public CardManager(KanbanSystemContext _context)
 {
     context = _context;
 }
Exemplo n.º 7
0
 public UserManager(KanbanSystemContext _context)
 {
     context = _context;
 }
Exemplo n.º 8
0
 public ManagerBase(KanbanSystemContext _context)
 {
     context = _context;
     set     = context.Set <T>();
 }