public async Task <IActionResult> Delete([FromBody] int[] ids) { var bpage = new BLL.Page(unitOfWork); // Delete photos var pagephotos = await new BLL.PagePhoto(unitOfWork).Get(ids); if (pagephotos.Count() > 0) { await new BLL.Photo(unitOfWork).Delete(pagephotos.Select(x => x.PhotoId).ToArray(), _environment); } await bpage.Delete(ids); return(Json("Success!")); }