Exemplo n.º 1
0
 public virtual void Attach(Abook entity)
 {
     entity.Name               = this.Name;
     entity.Memo               = this.Memo;
     entity.StartOfMonthDate   = this.StartOfMonthDate;
     entity.StartOfMonthIsPrev = this.StartOfMonthIsPrev;
 }
Exemplo n.º 2
0
        public virtual async Task <(string, ServiceModelState)> Create(
            AbookCreateModel model)
        {
            var user  = context.GetCurrentUser();
            var abook = new Abook
            {
                AbookId = Guid.NewGuid().ToString()
            };

            model.Attach(abook);

            var member = new AbookMember
            {
                AbookId  = abook.AbookId,
                UserId   = user.Id,
                Priority = 0
            };

            await context.Abooks.AddAsync(abook);

            await context.AbookMembers.AddAsync(member);

            await context.SaveChangesAsync();

            return(abook.AbookId, null);
        }
Exemplo n.º 3
0
 public AbookViewModel(Abook entity)
 {
     this.AbookId            = entity.AbookId;
     this.Name               = entity.Name;
     this.Memo               = entity.Memo;
     this.StartOfMonthDate   = entity.StartOfMonthDate;
     this.StartOfMonthIsPrev = entity.StartOfMonthIsPrev;
 }
Exemplo n.º 4
0
        public static AbookViewModel Of(Abook entity)
        {
            if (entity == null)
            {
                return(null);
            }

            return(new AbookViewModel(entity));
        }