Exemplo n.º 1
0
        public async Task <IActionResult> PutYearOfIssue(int id, YearOfIssue yearOfIssue)
        {
            if (id != yearOfIssue.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!YearOfIssueExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <YearOfIssue> > PostYearOfIssue(YearOfIssue yearOfIssue)
        {
            _context.YearOfIssue.Add(yearOfIssue);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetYearOfIssue", new { id = yearOfIssue.Id }, yearOfIssue));
        }
Exemplo n.º 3
0
 public bool Equals(Tank other)
 {
     return((Name.Length == 0 || other.Name.Length == 0 || Name.Equals(other.Name)) &&
            (Country.Length == 0 || other.Country.Length == 0 || Country.Equals(other.Country)) &&
            (YearOfIssue.Length == 0 || other.YearOfIssue.Length == 0 || YearOfIssue.Equals(other.YearOfIssue)) &&
            (MainCaliber.Length == 0 || other.MainCaliber.Length == 0 || MainCaliber.Equals(other.MainCaliber)) &&
            (Armor.Length == 0 || other.Armor.Length == 0 || Armor.Equals(other.Armor)) &&
            (Weight.Length == 0 || other.Weight.Length == 0 || Weight.Equals(other.Weight)));
 }