public async Task <IActionResult> ShareAsync() { var fsoIdcsv = Request.Form["fsoIdcsv"].ToString(); var user = await _userService.GetUserFromPrincipalAsync(this.User); int[] fsoIdArray = Array.ConvertAll(fsoIdcsv.Split(','), int.Parse); if (string.IsNullOrEmpty(fsoIdcsv)) { return(BadRequest()); } var fsoList = await _fsoService.GetFsoListByIdAsync(fsoIdArray); foreach (var fso in fsoList) { if (!await _fsoService.CheckOwnerAsync(fso, user)) { return(Forbid()); } } var shareKey = await _shareService.CreateShareAsync(fsoList, user); return(Ok(shareKey)); }
public async Task <IActionResult> GetFsoFullPathAsync(int id) { var fso = await _fsoService.GetFsoByIdAsync(id); var user = await _userService.GetUserFromPrincipalAsync(this.User); if (fso == null) { return(NotFound()); } if (!await _fsoService.CheckOwnerAsync(fso, user)) { return(Forbid()); } var list = await _fsoService.GetFsoFullPathAsync(fso); var listDTO = _fsoService.ToDTO(list); return(new JsonResult(listDTO)); }