コード例 #1
0
        public async Task <ActionResult <LocationPrefix> > PostLocationPrefix(LocationPrefix locationPrefix)
        {
            _context.LocationPrefixes.Add(locationPrefix);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLocationPrefix", new { id = locationPrefix.Id }, locationPrefix));
        }
コード例 #2
0
        public async Task <IActionResult> PutLocationPrefix(Guid id, LocationPrefix locationPrefix)
        {
            if (id != locationPrefix.Id)
            {
                return(BadRequest());
            }

            _context.Entry(locationPrefix).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LocationPrefixExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    return(StatusCode(StatusCodes.Status500InternalServerError));
                }
            }

            return(NoContent());
        }
コード例 #3
0
 public Location(LocationPrefix prefix, string streetName, int streetNumber, string district, string ZIPCode, string complement)
 {
     this.prefix       = prefix;
     this.streetName   = streetName;
     this.streetNumber = streetNumber;
     this.district     = district;
     this.ZIPCode      = ZIPCode;
     this.complement   = complement;
 }
コード例 #4
0
 public Location()
 {
     prefix       = LocationPrefix.Invalid;
     streetNumber = -1;
 }