Example #1
0
        public void deleteStatus(int id)
        {
            Status Status = StatusRepository.GetById(id);

            StatusRepository.Delete(Status);
            SaveChange();
        }
        public bool Delete(long id, string updatedBy)
        {
            var status = _statusRepository.GetById(id);

            status.IsActive  = false;
            status.UpdatedBy = updatedBy;
            return(_statusRepository.Update(status));
        }
        public async Task Update(int id, EditAnimalDto updateData)
        {
            if (updateData == null)
            {
                throw new ArgumentNullException(nameof(updateData));
            }

            var itemToUpdate = await _repository.GetById(id);

            if (itemToUpdate == null)
            {
                throw new InvalidOperationException($"Animal {id} was not found");
            }

            //var modificationDate = _timeService.GetCurrentTime();
            itemToUpdate.Status = await _statusRepository.GetById(updateData.StatusID);

            if (itemToUpdate.Status == null)
            {
                throw new InvalidOperationException($"Status {updateData.StatusID} was not found");
            }
            _mapper.Map(updateData, itemToUpdate);
            //itemToUpdate.LastModified = modificationDate;
            await _repository.Update(itemToUpdate);
        }
Example #4
0
        private Control getStatusControl(PrintRun pr)
        {
            DropDownList dropListStatus = new DropDownList();

            dropListStatus.ID = pr.runID.ToString();

            IStatusRepository statusRepository = RepositoryFactory.Get <IStatusRepository>();
            var query = statusRepository.Statuses.ToList();

            foreach (int statusID in Enum.GetValues(typeof(PWAS_Site.PrintRunStatus)))
            {
                if (statusID != OrderConstants.ORDER_STATUS_CREATED)
                {
                    ListItem lsItem = new ListItem(statusRepository.GetById(statusID).statusName);
                    dropListStatus.Items.Add(lsItem);

                    if (pr.Status.statusId == statusID)
                    {
                        dropListStatus.SelectedIndex = dropListStatus.Items.IndexOf(lsItem);
                    }

                    if (pr.Status.statusId == OrderConstants.ORDER_STATUS_CLOSED)
                    {
                        dropListStatus.Enabled = false;
                    }
                }
            }

            if (pr.Status.statusId == OrderConstants.ORDER_STATUS_CREATED)
            {
                ListItem lsItem = new ListItem(statusRepository.GetById(pr.Status.statusId).statusName);
                dropListStatus.Items.Add(lsItem);
                dropListStatus.SelectedIndex = dropListStatus.Items.IndexOf(lsItem);
                dropListStatus.Enabled       = false;
            }

            dropListStatus.Width = Unit.Pixel(200);
            dropListStatus.SelectedIndexChanged += new EventHandler(func_selected);
            dropListStatus.AutoPostBack          = true;

            return(dropListStatus);
        }
Example #5
0
        public void CreateConcept_Calls_InsertMediaForConcept_On_Success()
        {
            var mockConcept      = Mock.MockConcept(_status);
            var mockMediaConcept = Mock.MockCreateOrUpdateConcept();

            A.CallTo(() => StatusRepository.GetById(A <int> ._)).Returns(_status);
            A.CallTo(() => ConceptRepository.Insert(A <Concept> ._)).Returns(mockConcept);
            A.CallTo(() => ConceptMediaRepository.InsertMediaForConcept(A <int> ._, A <List <MediaWithMediaType> > ._)).Returns(new List <ConceptMedia>());
            var viewModel = Service.CreateConcept(mockMediaConcept, _userInfo);

            A.CallTo(() => ConceptMediaRepository.InsertMediaForConcept(A <int> ._, A <List <MediaWithMediaType> > ._))
            .MustHaveHappened(1, Times.Exactly);
        }
Example #6
0
        public static Status getCurrentOrderStatus(int orderID)
        {
            IOrderRepository  orderRepository = RepositoryFactory.Get <IOrderRepository>();
            IStatusRepository statusReposiory = RepositoryFactory.Get <IStatusRepository>();

            Order currentOrder = orderRepository.GetById(orderID);

            int tempStatus = (int)currentOrder.currentStatus;

            Status currentStatus = statusReposiory.GetById(tempStatus);

            return(currentStatus);
        }
 public IActionResult StatusEdit(long id)
 {
     try
     {
         var output = _statusRepository.GetById(id);
         if (output != null)
             return Ok(output);
         else
             return NotFound(_NotFound);
     }
     catch (Exception e)
     {
         return BadRequest(e);
     }
 }
 public async Task <Status> GetById(User user, Guid id)
 {
     try
     {
         var status = _statusRepository.GetById(id);
         if ((status.fk_UserId == user.Id || status.fk_UserId == null) && !status.Deleted)
         {
             return(status);
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #9
0
        public ConceptServiceTest()
        {
            ConceptMediaRepository = A.Fake <IConceptMediaRepository>();
            ConceptRepository      = A.Fake <IConceptRepository>();
            StatusRepository       = A.Fake <IStatusRepository>();
            LanguageRepository     = A.Fake <ILanguageRepository>();
            MetadataRepository     = A.Fake <IMetadataRepository>();
            UrlHelper = A.Fake <IUrlHelper>();

            Mapper = AutoMapper.Mapper.Instance;

            Service                 = new ConceptService(ConceptRepository, StatusRepository, ConceptMediaRepository, MetadataRepository, LanguageRepository, Mapper, UrlHelper);
            Mock                    = new Mock.Mock();
            _status                 = new Status();
            BaseListQuery           = BaseListQuery.DefaultValues("nb");
            _language               = new Language();
            _listOfMetaWithLanguage = new List <MetaData> {
                new MetaData
                {
                    Language = _language, Category = new MetaCategory {
                        TypeGroup = new TypeGroup {
                            Name = "language"
                        }
                    }
                }
            };
            _userInfo = new UserInfo
            {
                FullName = "Fullname",
                Email    = "Email"
            };

            A.CallTo(() => StatusRepository.GetById(A <int> ._)).Returns(null);
            A.CallTo(() => MetadataRepository.GetByRangeOfIds(A <List <int> > ._)).Returns(_listOfMetaWithLanguage);
            A.CallTo(() => LanguageRepository.GetByAbbreviation(A <string> ._)).Returns(_language);
        }
 public Models.Domain.Status GetById(int id)
 {
     return(_statusRepository.GetById(id));
 }
Example #11
0
 public bool StatusIdIsValidId(int id)
 {
     return(_statusRepository.GetById(id) != null);
 }
Example #12
0
 public async Task <Models.Status> GetByIdAsync(int id)
 {
     return(await _repository.GetById(id));
 }
Example #13
0
 public StatusDto GetStatus(int id)
 {
     return(_mapper.Map <StatusDto>(_statusRepository.GetById(id)));
 }
        public ActionResult Edit(int id)
        {
            var statuses = _status.GetById(w => w.ID == id);

            return(View(statuses));
        }
Example #15
0
 public Status GetById(Guid id) => _statusRepository.GetById(id);
Example #16
0
        public void StatusIdIsValidId_Returns_False_When_Id_Does_Not_Exist_In_The_DB()
        {
            A.CallTo(() => _statusRepository.GetById(A <int> ._)).Returns(null);

            Assert.False(_validationService.StatusIdIsValidId(0));
        }