Example #1
0
        // GET: StudentsController/Create
        public async Task <ActionResult> AddAsync()
        {
            try
            {
                var deps     = _departamentsRepository.GetAll();
                var statuses = _statusRepository.GetAll();

                await Task.WhenAll(deps, statuses);

                if (deps.Result.Item1)
                {
                    ViewBag.DepartmentId = new SelectList(deps.Result.Item2, "Id", "DepartmentName");
                    ViewBag.StatusId     = new SelectList(statuses.Result.Item2, "Id", "Name");
                    return(View());
                }
                else
                {
                    TempData["SuccessResultF"] = deps.Result.Item1;
                    TempData["SuccessResultM"] = "You are not logged in!";
                    return(RedirectToAction("Login", "Home"));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public void GetByName_Returns_A_Status()
        {
            Assert.Empty(StatusRepository.GetAll(QueryWithDefaultValues));

            Mock.Database.InsertStatus(_status);

            Assert.NotNull(StatusRepository.GetByName(_status.TypeGroup.Name));
        }
 public async Task <ICollection <Status> > GetAll(User user)
 {
     try
     {
         return(_statusRepository.GetAll().Where(x => (x.fk_UserId == user.Id || x.fk_UserId == null) && !x.Deleted).ToList());
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #4
0
        public List <Status> GetStatusList()
        {
            var statusEntityList = _statusRepository.GetAll();
            var statusList       = Mapper.Map <List <Status> >(statusEntityList);

            return(statusList);
        }
Example #5
0
        public Response GetAllStatus(BaseListQuery query)
        {
            try
            {
                var status = _statusRepository.GetAll(query);

                var totalItems    = 0;
                var numberOfPages = 0;

                try
                {
                    totalItems    = status.FirstOrDefault().TotalItems;
                    numberOfPages = status.FirstOrDefault().NumberOfPages;
                }
                catch { }

                return(new Response
                {
                    Data = new PagingDTO <StatusDTO>(
                        Mapper.Map <List <StatusDTO> >(status),
                        query,
                        UrlHelper.Action("GetAllStatus", "Status", query),
                        numberOfPages,
                        totalItems)
                });
            }
            catch
            {
                return(null);
            }
        }
Example #6
0
        public async Task <IActionResult> GetStatusesAsync()
        {
            var professorItems = await _context.GetAll();

            _log.AddLog(Request, _httpContextAccessor, this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), "Eshte nxjerrur lista e statuseve");
            return(Ok(_mapper.Map <IEnumerable <ReadStatusesDTO> >(professorItems)));
        }
        public T New <T>() where T : new()
        {
            var model = new T();

            if (model is INeedCountries countryModel)
            {
                countryModel.Countries = referenceDataProvider.GetCountries();
            }

            if (model is INeedCounties countyModel)
            {
                countyModel.Counties = referenceDataProvider.GetCounties();
            }

            if (model is INeedStandards standardModel)
            {
                standardModel.Standards = statusRepository
                                          .GetAll <LicensingStandard>()
                                          .Select(s => new CheckboxListItem {
                    Id = s.Id, Name = s.Name
                })
                                          .ToList();
            }

            return(model);
        }
        public ViewResult Edit(int?id, string callback)
        {
            if (id == null)
            {
                return(View());
            }

            TaskEditViewModel model = new TaskEditViewModel()
            {
                Callback = callback,
                Task     = _taskRepository.GetById(id.Value),
                Statuses = _sr.GetAll()
            };

            return(View(model));
        }
Example #9
0
        public ViewResult List(int?offset, int?limit)
        {
            if (offset == null)
            {
                offset = 0;
            }

            if (limit == null)
            {
                limit = 10;
            }

            var checkLists = _checkListRepository.GetAll(offset.Value, limit.Value);
            var statuses   = _sr.GetAll();

            var clvm = new CheckListViewModel()
            {
                Checklists = checkLists,
                Statuses   = statuses
            };

            return(View(clvm));
        }
Example #10
0
        public async Task CreateDocument(Document document)
        {
            try
            {
                StatusEntity statusEntity = _statusRepository
                                            .GetAll()
                                            .AsNoTracking()
                                            .FirstOrDefault(s => s.Name == "Approved");

                document.Status = Mapper.Map <StatusEntity, Status>(statusEntity);

                DocumentEntity documentEntity = Mapper.Map <Document, DocumentEntity>(document);

                documentEntity.UsersWithApprove = documentEntity.Reviewers;

                _documentRepository.Add(documentEntity);

                await _documentRepository.CommitAsync();
            }
            catch (Exception e)
            {
                throw new DocManagerException("Error during document creation.", e.Message, e);
            }
        }
        public IActionResult StatusList()
        {
            try
            {

                var output = _statusRepository.GetAll();

                if (output.Count() > 0)
                    return Ok(output);
                else
                    return Ok(new GenericResult { Response = true, Message = "Status record is empty" });

            }
            catch (Exception e)
            {
                return BadRequest(e);
            }

        }
Example #12
0
 public IEnumerable <Status> GetAll() => _statusRepository.GetAll();
Example #13
0
 public IEnumerable <Status> GetAllStatus(string lang = "")
 {
     return(databasePlaceholder.GetAll(lang));
 }
 public IEnumerable <Status> GetAll()
 {
     return(_statusRepository.GetAll());
 }
Example #15
0
 public ICollection <StatusDto> GetStatuses()
 {
     return(_mapper.Map <ICollection <StatusDto> >(_statusRepository.GetAll()));
 }
        public IActionResult Index()
        {
            var statuses = _status.GetAll();

            return(View(statuses));
        }
 public bool Exists(long id)
 {
     return(Repo.GetAll().Count(e => e.Id == id) > 0);
 }
Example #18
0
 public IList <Estado> GetItems()
 {
     return(_statusRepository.GetAll().OrderBy(x => x.Nombre).ToList());
 }
 public IEnumerable <StatusDto> GetAll()
 {
     return(_statusRepository.GetAll().MapToListDtoModels());
 }
Example #20
0
 public IEnumerable <DeliveryStatus> GetAllStatus()
 {
     return(statusRepository.GetAll());
 }
 public List <Models.Domain.Status> GetAll()
 {
     return(_statusRepository.GetAll());
 }
        public IEnumerable <Status> GetAll()
        {
            var result = _statusRepository.GetAll();

            return(result);
        }