Exemple #1
0
        public HttpResponseMessage Package(dynamic SearchForm)
        {
            try
            {
                string RegNo = string.Empty;
                RegNo = (string)SearchForm.RegNo;
                string    OutMsg = "No records found";
                UserClass CLE    = new UserClass();
                DataTable DT     = new DataTable();
                DT = CLE.Fn_Package(RegNo);

                List <PackageEntity> UserList = new List <PackageEntity>();
                if (DT.Rows.Count > 0)
                {
                    UserList = (from DataRow dr in DT.Rows
                                select new PackageEntity()
                    {
                        srno = dr["srno"].ToString(),
                        Pname = dr["Pname"].ToString(),
                        Amount = dr["Amount"].ToString(),
                        JoinFor = dr["JoinFor"].ToString(),
                        Points = (dr["Points"]).ToString(),
                        isactive = (dr["isactive"]).ToString()
                    }).ToList();
                    return(Request.CreateResponse(HttpStatusCode.OK, UserList));
                }

                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, OutMsg));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "500_Internal_Server_Error"));
            }
        }