Beispiel #1
0
        public async Task <OperationDetails> Create(UnderCycleDTO DTO)
        {
            UnderCycle newItem = new UnderCycle()
            {
                NameUnderCycle = DTO.UnderCycleName,
                CodeUnderCycle = DTO.Code,
                ID_cycle       = Database.RCycle.Get(DTO.CycleName).IdCycle
            };

            Database.RUnderCycle.Create(newItem);
            await Database.Save();

            return(new OperationDetails(true, "Registration success", ""));
        }
Beispiel #2
0
        public UnderCycleDTO FindUnderCycle(string name)
        {
            UnderCycle    item = Database.RUnderCycle.Get(name);
            UnderCycleDTO DTO  = null;

            if (item != null)
            {
                DTO = new UnderCycleDTO();

                DTO.Id_UnderCycle  = item.IdUnderCycle;
                DTO.UnderCycleName = item.NameUnderCycle;
                DTO.Code           = item.CodeUnderCycle;
                DTO.CycleName      = Database.RCycle.GetAll().Where(x => x.IdCycle == item.ID_cycle).SingleOrDefault().NameCycle;
            }

            return(DTO);
        }