public IHttpActionResult Search([FromUri] IzinCutiSearchFilter filter) { string accessType = "IzinCuti_ViewAll"; ThrowIfUserHasNoRole(accessType); if (filter == null) { throw new KairosException("Missing search filter parameter"); } if (filter.UserId <= 0) { throw new KairosException("Missing parameter 'userID'."); } using (var izinCutiSearch = new IzinCutiSearch(Db)) { var data = izinCutiSearch.GetDataByFilter(filter); var mobileResponse = (from records in data.Records.AsQueryable() select new { leaveId = records.IzinCuti_PK, dateStart = records.TglMulai, dateEnd = records.TglSelesai, content = records.Alasan, photo = records.FilePhotoInBase64, status = records.IzinCutiStatus_FK == null ? 1 : records.IzinCutiStatus_FK, statusName = records.IzinCutiStatusTitle }) .ToList(); return(Ok(mobileResponse)); } }
public IzinCutiListModel Get(IzinCutiSearchFilter searchFilter) { IzinCutiListFormData formData = new IzinCutiListFormData(); SearchResult <IzinCutiDTO> searchResult = izinCutiSearch.GetDataByFilter(searchFilter); return(new IzinCutiListModel() { FormData = formData, SearchResult = searchResult }); }
public IHttpActionResult Search([FromUri] IzinCutiSearchFilter filter) { ThrowIfUserHasNoRole(readRole); if (filter == null) { throw new KairosException("Missing search filter parameter"); } using (var izinCutiSearch = new IzinCutiSearch(Db)) { var data = izinCutiSearch.GetDataByFilter(filter); return(Ok(new SuccessResponse(data))); } }