当前位置: 首页>>代码示例>>C#>>正文


C# Response.Create方法代码示例

本文整理汇总了C#中System.Net.Response.Create方法的典型用法代码示例。如果您正苦于以下问题:C# Response.Create方法的具体用法?C# Response.Create怎么用?C# Response.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Net.Response的用法示例。


在下文中一共展示了Response.Create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Login

        public Response<RespLogin> Login(UserModel objUserModel)
        {
            List<RespLogin> objResp = new List<RespLogin>();
            Response<RespLogin> response = new Response<RespLogin>();
            try
            {
                objDBMethod = new DBMethod();

                if (CheckRequestIsvalidornot(this.Request))
                {
                    objResp.Add(objDBMethod.Login(objUserModel));
                    switch (objResp[0].restKey)
                    {

                        case "0":
                            response.Create(false, Messages.WebError, Messages.AppVersion, objResp);
                            break;
                        case "1":
                            response.Create(true, Messages.FormatMessage(Messages.Success, "Logged in "), Messages.AppVersion, objResp);
                            break;
                        case "2":
                            response.Create(false, Messages.NotAllowedUser, Messages.AppVersion, objResp);
                            break;
                        case "3":
                            response.Create(false, Messages.InvalidPassword, Messages.AppVersion, objResp);
                            break;
                        case "4":
                            response.Create(false, Messages.EmailVerify, Messages.AppVersion, objResp);
                            break;
                        case "5":
                            response.Create(true, Messages.AccountCreated, Messages.AppVersion, objResp);
                            break;
                        case "6":
                            response.Create(false, "Sorry!!! we were unable to fetch your email please change your Facebook settings for email.", Messages.AppVersion, objResp);
                            break;
                        default:
                            response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);
                            break;
                    }
                }
                else
                {
                    response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

                }

            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objUserModel);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }
            finally
            {
            }
            return response;
        }
开发者ID:rjdeveloper,项目名称:bigdecimalweb,代码行数:58,代码来源:WebServiceV2Controller.cs

示例2: AdminLogin

        public Response<byte> AdminLogin(LoginModel Data)
        {
            Response<byte> objresponse = new Response<byte>();
            byte result = 0;
            if (Data != null)
            {

                // string pwd = Encryption.Encrypt(Data.Password, ConstantValues.EncryptionKey);
                using (var db = new UnseentalentdbDataContext())
                {
                    var user = db.tbl_users.Where(t => t.email == Data.Email).FirstOrDefault();
                    if (user != null)
                    {

                        if (user.password == Data.Password)
                        {
                            CurrentUser currentUser = new CurrentUser()
                            {
                                Email = user.email,
                                FirstName = user.firstname,
                                isEmailVerify = true,
                                LastName = user.lastname,
                                ProfilePic = user.profilepic,
                                userid = user.id,
                                userrole = GetUserRole(user.id),

                            };
                            string json = JsonConvert.SerializeObject(currentUser);
                            FormsAuthentication.SetAuthCookie(json, Data.RememberMe);
                            result = 2;//sucess login

                            objresponse.Create(true, 0, "Admin login successfully", result);
                        }
                        else
                        {
                            result = 0; //Username password not valid
                            objresponse.Create(false, 1, "Admin login successfully", result);
                        }
                    }
                    else
                    {
                        result = 0;
                        objresponse.Create(false, 1, "Admin login successfully", result);
                    }

                }
            }
            return objresponse;
        }
开发者ID:gitAakash,项目名称:UnSeenTalents,代码行数:49,代码来源:UnseentalentApiController.cs

示例3: AddComment

        public Response<bool> AddComment(ReqAddComment objreq)
        {
            bool rst = false;
            Response<bool> objresponse = new Response<bool>();
            UnseenTalentsMethod objmethod = new UnseenTalentsMethod();

            try
            {
                rst = objmethod.SaveVideoComments(objreq);
                objresponse.Create(true, 0, "Events for admin", rst);

            }
            catch (Exception ex)
            {
                objresponse.Create(false, -1, "", rst);
            }
            return objresponse;
        }
开发者ID:gitAakash,项目名称:UnSeenTalents,代码行数:18,代码来源:UnseentalentApiController.cs

示例4: CancelSession

        public Response<string> CancelSession(UniqueRequestModel objReq)
        {
            Response<string> response = new Response<string>();
            List<string> objResp = new List<string>();
            try
            {
                objDbMethodV2 = new wizz.Dal.DbMethodsV2();

                if (CheckRequestIsvalidornot(this.Request))
                {
                    if (ModelState.IsValid)
                    {
                        if (objDbMethodV2.CancelSession(objReq))
                            response.Create(true, Messages.FormatMessage(Messages.Success, "Session cancelled"), Messages.AppVersion, objResp);
                        else
                            response.Create(false, Messages.ErrorOccure, Messages.AppVersion, objResp);
                    }
                    else
                        response.Create(false, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage, Messages.AppVersion, objResp);
                }
                else
                    response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }

            return response;
        }
开发者ID:rjdeveloper,项目名称:bigdecimalweb,代码行数:33,代码来源:WebServiceV2Controller.cs

示例5: SessionRatingByStudent

        public Response<string> SessionRatingByStudent(StudentRatingwModel objReq)
        {
            Response<string> response = new Response<string>();
            List<string> objResp = new List<string>();
            try
            {
                Session obj = new Session();
                if (CheckRequestIsvalidornot(this.Request))
                {
                    if (ModelState.IsValid)
                    {
                        if (obj.SessionRatingByStudent(objReq))
                            response.Create(true, Messages.FormatMessage(Messages.Success, "You have rated"), Messages.AppVersion, objResp);
                        else
                            response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

                    }
                    else
                        response.Create(false, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage, Messages.AppVersion, objResp);
                }
            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }
            return response;
        }
开发者ID:rjdeveloper,项目名称:bigdecimalweb,代码行数:29,代码来源:WebServiceV2Controller.cs

示例6: EndSession

        public Response<SessionEndResponseModel> EndSession(CreateSesion objReq)
        {
            Response<SessionEndResponseModel> response = new Response<SessionEndResponseModel>();
            List<SessionEndResponseModel> objResp = new List<SessionEndResponseModel>();
            try
            {
                Session obj = new Session();
                if (CheckRequestIsvalidornot(this.Request))
                {
                    if (ModelState.IsValid)
                    {
                        objResp.Add(obj.EndSession(objReq));
                        if (objResp.Count > 0)
                            response.Create(true, Messages.FormatMessage(Messages.Success, "You have ended session"), Messages.AppVersion, objResp);
                        else
                            response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);
                    }
                    else
                        response.Create(false, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage, Messages.AppVersion, objResp);
                }
                else
                    response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }
            return response;
        }
开发者ID:rjdeveloper,项目名称:bigdecimalweb,代码行数:32,代码来源:WebServiceV2Controller.cs

示例7: GetSessionInfo

        public Response<SessionInfo> GetSessionInfo(SessionEntity objReq)
        {
            Response<SessionInfo> response = new Response<SessionInfo>();
            List<SessionInfo> objResp = new List<SessionInfo>();
            try
            {
                Session obj = new Session();
                if (CheckRequestIsvalidornot(this.Request))
                {

                    objResp = obj.GetSessionInfo(objReq);

                    if (objResp != null)
                        response.Create(true, "Session Info", Messages.AppVersion, objResp);
                    else
                        response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

                }
            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }
            return response;
        }
开发者ID:rjdeveloper,项目名称:bigdecimalweb,代码行数:27,代码来源:WebServiceV2Controller.cs

示例8: SaveStudentRequest

        public Response<SearchResponseTutorsModel> SaveStudentRequest(StudentRequestModelV2 objReq)
        {
            Response<SearchResponseTutorsModel> response = new Response<SearchResponseTutorsModel>();
            List<SearchResponseTutorsModel> objResp = new List<SearchResponseTutorsModel>();
            try
            {
                objDbMethodV2 = new wizz.Dal.DbMethodsV2();

                if (CheckRequestIsvalidornot(this.Request))
                {
                    if (ModelState.IsValid)
                    {
                        objResp.Add(objDbMethodV2.SaveStudentRequest(objReq));
                        if (objResp.Count > 0)
                            response.Create(true, Messages.FormatMessage(Messages.Success, "Student request saved"), Messages.AppVersion, objResp);
                        else
                            response.Create(false, "No tutor Found", Messages.AppVersion, objResp);
                    }
                    else
                        response.Create(false, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage, Messages.AppVersion, objResp);
                }
                else
                    response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }

            return response;
        }
开发者ID:rjdeveloper,项目名称:bigdecimalweb,代码行数:34,代码来源:WebServiceV2Controller.cs

示例9: GetProfile

        public Response<RespLogin> GetProfile(Entity objReq)
        {
            List<RespLogin> objResp = new List<RespLogin>();
            Response<RespLogin> response = new Response<RespLogin>();
            try
            {
                objDBMethod = new DBMethod();

                if (CheckRequestIsvalidornot(this.Request))
                {
                    objResp.Add(objDBMethod.GetUser(objReq));
                    response.Create(true, "User Data", Messages.AppVersion, objResp);

                }
                else
                {
                    response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

                }

            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }
            return response;
        }
开发者ID:rjdeveloper,项目名称:bigdecimalweb,代码行数:29,代码来源:WebServiceV2Controller.cs

示例10: ChangeTutorStatus

        public Response<RespIsTeacherRequest> ChangeTutorStatus(IsTeacherRequest objReq)
        {
            Response<RespIsTeacherRequest> response = new Response<RespIsTeacherRequest>();
            List<RespIsTeacherRequest> objResp = new List<RespIsTeacherRequest>();
            try
            {
                WebMethods objDBMethod = new WebMethods();

                if (CheckRequestIsvalidornot(this.Request))
                {
                    if (ModelState.IsValid)
                    {
                        objResp.Add(objDBMethod.isTeacher(objReq));
                        if (objResp != null)
                        {

                            response.Create(true, Messages.FormatMessage(Messages.Success, "Status Changed"), Messages.AppVersion, objResp);

                        }
                        else
                        {

                            response.Create(false, Messages.ErrorOccure, Messages.AppVersion, objResp);
                        }



                    }
                    else
                        response.Create(false, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage, Messages.AppVersion, objResp);
                }
                else
                    response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }
            finally
            {
            }
            return response;
        }
开发者ID:rjdeveloper,项目名称:bigdecimalweb,代码行数:46,代码来源:WebServiceV2Controller.cs

示例11: ChangePassword

        public Response<string> ChangePassword(ChangePasswordModel objReq)
        {
            Response<string> response = new Response<string>();
            List<string> objResp = new List<string>();
            try
            {
                WebMethods objDBMethod = new WebMethods();

                if (CheckRequestIsvalidornot(this.Request))
                {
                    if (ModelState.IsValid)
                    {
                        switch (objDBMethod.ChangePassword(objReq))
                        {
                            case 1:
                                response.Create(true, Messages.FormatMessage(Messages.Success, "Password changed"), Messages.AppVersion, objResp);
                                break;
                            case 0:
                                response.Create(false, "User do not exists", Messages.AppVersion, objResp);
                                break;
                            case 2:
                                response.Create(false, "You are not allowed to change", Messages.AppVersion, objResp);
                                break;
                            case 3:
                                response.Create(false, "Your old password is wrong", Messages.AppVersion, objResp);
                                break;
                            default:
                                break;
                        }



                    }
                    else
                        response.Create(false, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage, Messages.AppVersion, objResp);
                }
                else
                    response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }

            return response;
        }
开发者ID:rjdeveloper,项目名称:bigdecimalweb,代码行数:49,代码来源:WebServiceV2Controller.cs

示例12: UpdateUser

        public Response<string> UpdateUser()
        {
            UserModel objReq = new UserModel();
            Response<string> response = new Response<string>();
            List<string> objResp = new List<string>();

            string resp = "";

            try
            {
                objDBMethod = new DBMethod();

                if (CheckRequestIsvalidornot(this.Request))
                {
                    // //HttpContextWrapper objwrapper = GetHttpContext(this.Request);
                    //   HttpFileCollectionBase collection = objwrapper.Request.Files;

                    // string jsonvalue = objwrapper.Request.Form["json"];
                    HttpContextWrapper objwrapper = GetHttpContext(this.Request);
                    HttpFileCollectionBase collection = objwrapper.Request.Files;

                    //var s = HttpContext.Current.Request;
                    //string jsonVlaue = s.Form["json"];
                    //HttpFileCollectionBase o = s.Files;


                    string jsonvalue = objwrapper.Request.Form["json"];
                    if (!string.IsNullOrEmpty(jsonvalue))
                    {
                        objReq = JsonConvert.DeserializeObject<UserModel>(jsonvalue);
                        objReq.profilePic = SaveImage(collection, objReq.profilePic);

                        resp = objDBMethod.UpdateUser(objReq);
                        switch (Convert.ToInt32(resp))
                        {
                            case 0:
                                response.Create(false, "No user found", Messages.AppVersion, objResp);
                                break;
                            case 1:
                                response.Create(true, "Profile updated successfully", Messages.AppVersion, objResp);
                                break;
                            case 2:
                                response.Create(true, "You are blocked from admin", Messages.AppVersion, objResp);
                                break;

                            default:
                                break;
                        }
                    }
                    else
                    {
                        response.Create(false, Messages.InvalidReq, Messages.AppVersion, objResp);
                    }
                }
                else
                {
                    response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

                }

            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error(ex.Message, ex, session, ex.Message);
                response.Create(false, "Error occured while Processing Webservice request", Messages.AppVersion, objResp);
            }
            finally
            {
            }
            return response;
        }
开发者ID:rjdeveloper,项目名称:bigdecimalweb,代码行数:72,代码来源:WebServiceV2Controller.cs

示例13: IsApprovedTutor

 public Response<RespIsTutor> IsApprovedTutor(Entity objReq)
 {
     Response<RespIsTutor> response = new Response<RespIsTutor>();
     List<RespIsTutor> objResp = new List<RespIsTutor>();
     try
     {
         var obj = new Tutor();
         if (CheckRequestIsvalidornot(this.Request))
         {
             //  var resp = obj.IsApprovedTutor(objReq);
             objResp.Add(obj.IsApprovedTutor(objReq));
             response.Create(true, Messages.FormatMessage(Messages.Success, "Tutor "), Messages.AppVersion, objResp);
         }
         else
         {
             response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);
         }
     }
     catch (Exception ex)
     {
         object session = new JavaScriptSerializer().Serialize(objReq);
         LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
         response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
     }
     return response;
 }
开发者ID:rjdeveloper,项目名称:bigdecimalweb,代码行数:26,代码来源:WebServiceV2Controller.cs

示例14: GetTutorBySearchCode

        public Response<SearchResponseTutorsModel> GetTutorBySearchCode(SearchTutorByCodeModel objReq)
        {
            Response<SearchResponseTutorsModel> response = new Response<SearchResponseTutorsModel>();
            List<SearchResponseTutorsModel> objResp = new List<SearchResponseTutorsModel>();


            try
            {
                if (ModelState.IsValid)
                {
                    objDbMethodV2 = new wizz.Dal.DbMethodsV2();
                    if (CheckRequestIsvalidornot(this.Request))
                    {
                        objResp.Add(objDbMethodV2.GetTutorBySearchCode(objReq));
                        if (objResp.Count > 0)
                            response.Create(true, "Tutor Data ", Messages.AppVersion, objResp);
                    }
                    else
                    {
                        response.Create(false, Messages.FormatMessage("Sorry no tutor found !!"), Messages.AppVersion, objResp);
                    }
                }
                else
                    response.Create(false, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage, Messages.AppVersion, objResp);
            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }
            return response;
        }
开发者ID:rjdeveloper,项目名称:bigdecimalweb,代码行数:33,代码来源:WebServiceV2Controller.cs

示例15: SaveTutorProfile

        public Response<string> SaveTutorProfile()
        {
            TutorProfileModel objReq = new TutorProfileModel();
            Response<string> response = new Response<string>();
            List<string> objResp = new List<string>();
            int resp = 0;
            try
            {
                objDbMethodV2 = new wizz.Dal.DbMethodsV2();
                if (CheckRequestIsvalidornot(this.Request))
                {
                    HttpContextWrapper objwrapper = GetHttpContext(this.Request);
                    HttpFileCollectionBase collection = objwrapper.Request.Files;
                    string jsonvalue = objwrapper.Request.Form["json"];
                    if (!string.IsNullOrEmpty(jsonvalue))
                    {
                        objReq = JsonConvert.DeserializeObject<TutorProfileModel>(jsonvalue);

                        List<string> newFileNames = new List<string>();

                        newFileNames = SaveMultipleFiles(collection, "");
                        //    objReq.fileNameList = newFileNames;
                        if (newFileNames.Count == 0)
                            response.Create(false, "No Transcripts is uploaded please try again !", Messages.AppVersion, objResp);
                        else
                            resp = objDbMethodV2.SaveTutorProfile(objReq, newFileNames);
                        if (resp == 1)
                        {
                            response.Create(true, "Tutor profile info saved successfully !", Messages.AppVersion, objResp);

                        }
                        else
                        {
                            response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);

                        }

                    }

                }
                return response;
            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }
            return response;
        }
开发者ID:rjdeveloper,项目名称:bigdecimalweb,代码行数:50,代码来源:WebServiceV2Controller.cs


注:本文中的System.Net.Response.Create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。