public async Task <ApiLibraryResponse> DeleteLibrary(long id) { var apiResp = new ApiLibraryResponse { ResponseType = -1, ResponseMessage = "Failed" }; var createdBy = 1; var deleted = await(new JukeBox.BLL.Library()).DeleteLibrary(id, createdBy); if (deleted) { var retVal = await(new JukeBox.BLL.Library()).GetLibrary(0, 0); if (retVal.Count > 0) { apiResp.ResponseObject = new List <ApiLibrary>(); foreach (var _library in retVal) { var library = new ApiLibrary(); library.Bind(_library); apiResp.ResponseObject.Add(library); } apiResp.ResponseType = 1; apiResp.ResponseMessage = "Success"; } } return(apiResp); }
public async Task <ApiLibraryResponse> GetLibrary(int filter, int?clientid = null) { var apiResp = new ApiLibraryResponse { ResponseType = -1, ResponseMessage = "Failed" }; var retVal = await(new JukeBox.BLL.Library()).GetLibrary(filter, clientid); if (retVal.Count > 0) { apiResp.ResponseObject = new List <ApiLibrary>(); foreach (var _library in retVal) { var library = new ApiLibrary(); library.Bind(_library); apiResp.ResponseObject.Add(library); } apiResp.ResponseType = 1; apiResp.ResponseMessage = "Success"; } return(apiResp); }