Exemplo n.º 1
0
        public async Task <IActionResult> PutAspNetUsers(string id, datamodels.AspNetRoles role)
        {
            if (id != role.Id)
            {
                return(BadRequest());
            }

            try
            {
                var mapaux = _mapper.Map <datamodels.AspNetRoles, data.AspNetRoles>(role);

                new Solution.BS.AspNetRoles(_context).Update(mapaux);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AspNetUsersExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutAspNetRoles(int id, datamodels.AspNetRoles aspNetRoles)
        {
            if (id.Equals(aspNetRoles.Id))
            {
                return(BadRequest());
            }

            try
            {
                var mapaux = _mapper.Map <datamodels.AspNetRoles, data.AspNetRoles>(aspNetRoles);
                new Solution.BS.AspNetRoles(_context).Update(mapaux);
            }
            catch (Exception ee)
            {
                if (!AspNetRolesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 3
0
        public async Task <ActionResult <datamodels.AspNetRoles> > PostAspNetUsers(datamodels.AspNetRoles role)
        {
            var mapaux = _mapper.Map <datamodels.AspNetRoles, data.AspNetRoles>(role);

            new Solution.BS.AspNetRoles(_context).Insert(mapaux);

            return(CreatedAtAction("GetAspNetUsers", new { id = role.Id }, role));
        }