Example #1
0
        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));
            }
        }
Example #2
0
        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)));
            }
        }
Example #3
0
 public IzinCutiListDataProvider(GlobalSolusindoDb db, tblM_User user, IzinCutiSearch izinCutiSearch) : base(db, user)
 {
     this.izinCutiSearch = izinCutiSearch;
 }