public virtual async Task <(AbookViewModel, ServiceModelState)> GetCurrent() { var user = context.GetCurrentUser(); var abook = await context.Abooks.AsNoTracking() .WhereById(user.CurrentAbookId) .SingleOrDefaultAsync(); return(AbookViewModel.Of(abook), null); }
public virtual async Task <(AbookViewModel, ServiceModelState)> Update( AbookUpdateModel model) { var user = context.GetCurrentUser(); var edit = await context.Abooks .WhereById(user.CurrentAbookId) .SingleOrDefaultAsync(); if (edit != null) { model.Attach(edit); await context.SaveChangesAsync(); } return(AbookViewModel.Of(edit), null); }