コード例 #1
0
 public IHttpActionResult Get()
 {
     if (divisi.Get() == null)
     {
         return(Content(HttpStatusCode.NotFound, "Data Divisi is Empty!"));
     }
     return(Ok(divisi.Get()));
 }
コード例 #2
0
 public IEnumerable <StudyDivisionContract> Get()
 {
     return(divisionsRepository
            .Get()
            .Select(d => new StudyDivisionContract
     {
         Oid = d.Oid,
         Name = d.GetNameByLanguage(language),
         Alias = d.Alias
     })
            .OrderBy(d => d.Name));
 }
コード例 #3
0
        public ChangeActivityOutput <DivisionDto, long> ChangeActivity(ChangeActivityInput input)
        {
            DivisionRepository.Includes.Add(r => r.LastModifierUser);
            DivisionRepository.Includes.Add(r => r.CreatorUser);
            DivisionRepository.Includes.Add(r => r.Teams);

            Division divisionEntity = DivisionRepository.Get(input.EntityId);

            if (divisionEntity == null)
            {
                throw new CityQuestItemNotFoundException(CityQuestConsts.CityQuestItemNotFoundExceptionMessageBody, "\"Division\"");
            }

            if (!DivisionPolicy.CanChangeActivityForEntity(divisionEntity))
            {
                throw new CityQuestPolicyException(CityQuestConsts.CQPolicyExceptionChangeActivityDenied, "\"Division\"");
            }

            divisionEntity.IsActive = input.IsActive == null ? !divisionEntity.IsActive : (bool)input.IsActive;

            DivisionDto newDivisionDto = (divisionEntity).MapTo <DivisionDto>();

            DivisionRepository.Update(divisionEntity);

            DivisionRepository.Includes.Clear();

            return(new ChangeActivityOutput <DivisionDto, long>()
            {
                Entity = newDivisionDto
            });
        }
コード例 #4
0
        public UpdateOutput <DivisionDto, long> Update(UpdateInput <DivisionDto, long> input)
        {
            Division newDivisionEntity = input.Entity.MapTo <Division>();

            if (newDivisionEntity == null)
            {
                throw new CityQuestItemNotFoundException(CityQuestConsts.CityQuestItemNotFoundExceptionMessageBody, "\"Division\"");
            }

            if (!DivisionPolicy.CanUpdateEntity(newDivisionEntity))
            {
                throw new CityQuestPolicyException(CityQuestConsts.CQPolicyExceptionUpdateDenied, "\"Division\"");
            }

            DivisionRepository.Includes.Add(r => r.LastModifierUser);
            DivisionRepository.Includes.Add(r => r.CreatorUser);
            DivisionRepository.Includes.Add(r => r.Teams);

            DivisionRepository.Update(newDivisionEntity);
            DivisionDto newDivisionDto = (DivisionRepository.Get(newDivisionEntity.Id)).MapTo <DivisionDto>();

            DivisionRepository.Includes.Clear();

            return(new UpdateOutput <DivisionDto, long>()
            {
                UpdatedEntity = newDivisionDto
            });
        }
コード例 #5
0
        public DeleteOutput <long> Delete(DeleteInput <long> input)
        {
            Division divisionEntityForDelete = DivisionRepository.Get(input.EntityId);

            if (divisionEntityForDelete == null)
            {
                throw new CityQuestItemNotFoundException(CityQuestConsts.CityQuestItemNotFoundExceptionMessageBody, "\"Division\"");
            }

            if (!DivisionPolicy.CanDeleteEntity(divisionEntityForDelete))
            {
                throw new CityQuestPolicyException(CityQuestConsts.CQPolicyExceptionDeleteDenied, "\"Division\"");
            }

            DivisionRepository.Delete(divisionEntityForDelete);

            return(new DeleteOutput <long>()
            {
                DeletedEntityId = input.EntityId
            });
        }
コード例 #6
0
        public HttpResponseMessage GetPersonalById(HttpRequestMessage request, int Id)
        {
            PersonalDivisionSection personal = (from per in personalRepo.GetWithoutTracking().Where(a => a.IsDeleted != true && a.PersonalID == Id)
                                                join div in divisionRepo.GetWithoutTracking()
                                                on per.DivisionID equals div.DivisionID
                                                join sec in sectionRepo.GetWithoutTracking()
                                                on per.SectionID equals sec.SectionID
                                                select new PersonalDivisionSection
            {
                persoanl = per,
                division = div,
                section = sec,
            }).FirstOrDefault();
            List <Division> division     = divisionRepo.Get().ToList();
            List <Section>  section      = sectionRepo.Get().ToList();
            PersonalData    personaldata = new PersonalData();

            personaldata.personalDivisionSection = personal;
            personaldata.divisionData            = division;
            personaldata.sectionData             = section;


            return(Request.CreateResponse(HttpStatusCode.OK, personaldata));
        }
コード例 #7
0
        public HttpResponseMessage GetDivision(HttpRequestMessage request)
        {
            List <Division> result = divisionRepo.Get().ToList();

            return(request.CreateResponse(HttpStatusCode.OK, result));
        }
コード例 #8
0
        public IHttpActionResult Get()
        {
            var getdata = _repository.Get();

            return(Ok(getdata));
        }
コード例 #9
0
 public IEnumerable <DivisionVM> Get()
 {
     return(division.Get());
 }