コード例 #1
0
 public IActionResult AddLocation(Location location)
 {
     try
     {
         _locationServices.AddLocation(location);
         return(CreatedAtAction("AddLocation", location));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
コード例 #2
0
        protected async Task HandleValidSubmit()
        {
            Mapper.Map(EditLocationModel, Location);

            Location result = null;

            if (Location.id != 0)
            {
                result = await LocationServices.UpdateLocation(Location);
            }
            else
            {
                result = await LocationServices.AddLocation(Location);
            }
            if (result != null)
            {
                Navigation.NavigateTo("/Libraries");
            }
        }