コード例 #1
0
        public IActionResult Put(string id, [FromBody] CustomerContactInfoDTO modifiedCustomer)
        {
            try
            {
                using (NorthwindContext dbContext = new())
                {
                    CustomerSC.UpdateCustomer(dbContext, id, modifiedCustomer);
                }

                return(Ok());
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
コード例 #2
0
        public IActionResult Post([FromBody] CustomerContactInfoDTO newCustomer)
        {
            string id;

            try
            {
                using (NorthwindContext dbContext = new())
                {
                    id = CustomerSC.AddNewCustomer(dbContext, newCustomer);
                }

                return(Ok("Registered Id: " + id));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }