示例#1
0
        public async Task <ActionResult <Camp> > Post(CampModel entity)
        {
            try
            {
                var location = _linkGenerator.GetPathByAction("Get",
                                                              "Camps",
                                                              new { moniker = entity.Moniker });

                if (string.IsNullOrWhiteSpace(location))
                {
                    return(BadRequest("Could not use current moniker"));
                }

                await _generic.AddCamp(entity);

                return(Created(location, entity));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(StatusCode(StatusCodes.Status500InternalServerError, "Database Failure"));
            }
        }