예제 #1
0
        public ActionResult <Rol> GetRol(int id)
        {
            var rol = _rolRepository.GetById(id);

            if (rol == null)
            {
                return(NotFound());
            }

            return(rol);
        }
예제 #2
0
        public IActionResult Puntuar([FromBody] PuntuarDTO puntuarDTO, [FromQuery] int userId)
        {
            try
            {
                var user         = this.genericRepo.GetAllUserById(userId);
                var calificacion = new Data.Entities.Calificacion()
                {
                    Comentario       = puntuarDTO.Comentario,
                    Rol              = rolRepository.GetById(puntuarDTO.IdRol),
                    Puntuacion       = tipoCalificacionRepository.GetById(puntuarDTO.IdPuntuacion),
                    UsuarioPuntuador = genericRepo.GetAllUserById(puntuarDTO.IdUsuarioPuntuador),
                    Valor            = puntuarDTO.Valor
                };
                user.CalificacionesRecibidas.Add(calificacion);
                if (puntuarDTO.IdPendiente != 0)
                {
                    var calificacionPendiente = calificacion.UsuarioPuntuador.CalificacionesBrindadas.First(c => c.Id == puntuarDTO.IdPendiente);
                    calificacion.UsuarioPuntuador.CalificacionesBrindadas.Remove(calificacionPendiente);
                }
                this.genericRepo.Update(userId, user);

                return(Ok(true));
            }
            catch (Exception)
            {
                return(BadRequest("Hubo un error al calificar al usuario con id: " + userId));
            }
        }
예제 #3
0
 public ActionResult KayitOl(Kullanici kullanici)
 {
     kullanici.Aktif       = false;
     kullanici.KayitTarihi = DateTime.Now;
     kullanici.eMail_Onay  = false;
     kullanici.Rol         = _rolRepository.GetById(4);
     _kullaniciRepository.Insert(kullanici);
     _kullaniciRepository.Save();
     return(RedirectToAction("Login", "Account"));
 }
        public IHttpActionResult GetRol(int id)
        {
            var result = _rolRepository.GetById(id);

            if (result != null)
            {
                return(Ok(result));
            }
            else
            {
                return(NotFound());
            }
        }
예제 #5
0
 Sg07_Rol ObtenerRolId(long id)
 => _RolRepository.GetById <Sg07_Rol>(id);