示例#1
0
        public IActionResult Create()
        {
            var model = new ExameViewModel();

            model.GroupsList = _groupsService.GetAllGroups();
            return(View(model));
        }
示例#2
0
        public IActionResult GetAll()
        {
            var groups = _groupsService.GetAllGroups();

            if (groups == null)
            {
                return(NotFound());
            }
            return(Ok(groups));
        }
        public async Task GetAllGroups_ShouldBeDoneSuccessfully()
        {
            // Arrange
            var groups = new List <Group>()
            {
                new Group()
                {
                    Id = 1,
                }
            };

            var groupsToReturn = new List <GroupToReturnDto>()
            {
                new GroupToReturnDto()
                {
                    Id = 1,
                }
            };

            _unitOfWork.Setup(x => x.Groups.GetAllGroupsWithInclude(It.IsAny <int>()))
            .ReturnsAsync(groups);

            _mapperMock.Setup(x => x.Map <ICollection <GroupToReturnDto> >(groups))
            .Returns(groupsToReturn);

            // Act
            var result = await _sut.GetAllGroups(It.IsAny <int>());

            // Assert
            var group = result.FirstOrDefault();

            Assert.NotNull(group);
            Assert.NotNull(result);
            Assert.NotEmpty(result);
            Assert.Equal(1, group.Id);
        }
示例#4
0
 public IHttpActionResult GetAllGroups()
 {
     return(Ok(_groupSvc.GetAllGroups()));
 }
 public async Task <IActionResult> GetAllGroups(int userId)
 {
     return(Ok(await _groupsService.GetAllGroups(userId)));
 }
        void PopulateGroupsDropDownList(int?selectedId)
        {
            var allcources = _GroupsService.GetAllGroups();

            ViewBag.AllGroups = new SelectList(allcources, "Id", "Name", selectedId);
        }
示例#7
0
 public IActionResult Index(int pageNumber = 1, int pageSize = 10)
 {
     return(View(_groupsService.GetAllGroups(pageNumber, pageSize)));
 }