private async Task <(Lab lab, bool isLabManager)> GetLab(long labId) { var lab = await LabsDao.Read(this, labId); var isLabManager = IsLabManager(lab); return(lab, isLabManager); }
public async Task <IHttpActionResult> Read(long labId) { var(_, isLabManager) = await GetLab(labId); var result = await LabsDao.Read(this, labId); if (result == null) { return(NotFound()); } return(JsonWithPermissions(result, User.IsPrivileged(), isLabManager, User.IsAdmin())); }
public async Task <IHttpActionResult> Update(long labId, LabsEditViewModel model) { var(_, isLabManager) = await GetLab(labId); var lab = await LabsDao.Read(this, labId); if (lab == null) { return(NotFound()); } var result = await LabsDao.Update(this, lab, model); return(JsonWithPermissions(result, User.IsPrivileged(), isLabManager, User.IsAdmin())); }