Exemplo n.º 1
0
        public async Task <IActionResult> PutMstFranchisee([FromRoute] int id, [FromBody] MstFranchisee mstFranchisee)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != mstFranchisee.FranchiseId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PostMstFranchisee([FromBody] MstFranchisee mstFranchisee)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.MstFranchisee.Add(mstFranchisee);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMstFranchisee", new { id = mstFranchisee.FranchiseId }, mstFranchisee));
        }