public virtual void Attach(Abook entity) { entity.Name = this.Name; entity.Memo = this.Memo; entity.StartOfMonthDate = this.StartOfMonthDate; entity.StartOfMonthIsPrev = this.StartOfMonthIsPrev; }
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); }
public AbookViewModel(Abook entity) { this.AbookId = entity.AbookId; this.Name = entity.Name; this.Memo = entity.Memo; this.StartOfMonthDate = entity.StartOfMonthDate; this.StartOfMonthIsPrev = entity.StartOfMonthIsPrev; }
public static AbookViewModel Of(Abook entity) { if (entity == null) { return(null); } return(new AbookViewModel(entity)); }