Esempio n. 1
0
        public async Task <IActionResult> PutTypeContact(int id, TypeContact typeContact)
        {
            if (id != typeContact.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <ActionResult <TypeContact> > PostTypeContact(TypeContact typeContact)
        {
            _context.TypeContacts.Add(typeContact);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTypeContact", new { id = typeContact.Id }, typeContact));
        }
Esempio n. 3
0
 public void SetTypeContact(TypeContact typeContact)
 {
     this.typeContact = typeContact;
 }