コード例 #1
0
        public async Task <ActionResult <List <UserPlanModelResponse> > > GetListUserPlan([FromBody] UserPlanModel userPlanModel)
        {
            DatabaseHelperClass databaseHelperClass = new DatabaseHelperClass("YOUR_CONNECTIONSTRING");

            try
            {
                if (!ModelState.IsValid)
                {
                    throw new Exception("Model is Invalid");
                }

                GetListUserPlanRepository getListUserPlanRepository = new GetListUserPlanRepository(databaseHelperClass);
                DbGetListUserPlan         dbGetListUserPlan         = new DbGetListUserPlan(getListUserPlanRepository);
                var response = await dbGetListUserPlan.GetUSerPlanList(userPlanModel);

                return(Ok(response));
            }
            catch (Exception ex)
            {
                databaseHelperClass.connection.Close();
                return(StatusCode(500, "Internal Server Error"));
            }
        }
コード例 #2
0
        public async Task <ActionResult <List <UserPlanModelResponse> > > GetListUserPlan(UserPlanModel userPlanModel)
        {
            DatabaseHelperClass databaseHelperClass = new DatabaseHelperClass("Password=123456789;Persist Security Info=True;User ID=sqlserver;Initial Catalog=epharma;Data Source=34.95.222.223");

            try
            {
                if (!ModelState.IsValid)
                {
                    throw new Exception("Model is Invalid");
                }

                GetListUserPlanRepository getListUserPlanRepository = new GetListUserPlanRepository(databaseHelperClass);
                DbGetListUserPlan         dbGetListUserPlan         = new DbGetListUserPlan(getListUserPlanRepository);
                var response = await dbGetListUserPlan.GetUSerPlanList(userPlanModel);

                return(Ok(response));
            }
            catch (Exception ex)
            {
                databaseHelperClass.connection.Close();
                return(StatusCode(500, "Internal Server Error"));
            }
        }