Esempio n. 1
0
        public async Task <IActionResult> Post(Bussiness bussiness)
        {
            try
            {
                await db.Bussinesses.Add(bussiness);

                await db.Complete();

                return(Created(HttpContext.Request.Path, bussiness));
            }
            catch (Exception ex)
            {
                return(BadRequest(new
                {
                    Message = "No se ha podido agregar la empresa",
                    Exception = ex.InnerException?.Message ?? ex.Message
                }));
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> Post(Client client)
        {
            try
            {
                await db.Clients.Add(client);

                await db.Complete();

                return(Created(HttpContext.Request.Path, client));
            }
            catch (Exception ex)
            {
                return(BadRequest(new
                {
                    Message = "No se ha podido agregar el cliente",
                    Exception = ex.InnerException?.Message ?? ex.Message
                }));
            }
        }