コード例 #1
0
        public IActionResult GetDataFromViewField(string client_type, string fullName, DateTime birthDate, int _parent_id = 0)
        {
            if (client_type == "phys")
            {
                PhysClients new_client = new PhysClients
                {
                    client_name = fullName,
                    birth_date  = birthDate
                };

                DataContext.SendPhys(httpClient, new_client);

                return(Redirect("/Bank/Clients?client_type=phys"));
            }
            else if (client_type == "company")
            {
                CompanyClients new_client = new CompanyClients
                {
                    company_name = fullName,
                    create_date  = birthDate,
                    parent_id    = _parent_id
                };

                DataContext.SendCompany(httpClient, new_client);


                return(Redirect($"/Bank/Clients?client_type=company&parent_id={_parent_id}"));
            }
            else
            {
                return(Redirect("~/"));
            }
        }
コード例 #2
0
        static public void SendPhys(HttpClient httpClient, PhysClients phys_client)
        {
            string url = DataContext.server_adress + "phys";

            var r = httpClient.PostAsync(
                requestUri: url,
                content: new StringContent(JsonConvert.SerializeObject(phys_client), Encoding.UTF8,
                                           mediaType: "application/json")
                ).Result;
        }
コード例 #3
0
 public void Add(PhysClients phys)
 {
     context.PhysClients.Add(phys);
     context.SaveChanges();
 }
コード例 #4
0
 public void Post([FromBody] PhysClients client)
 {
     repository.Add(client);
 }