Exemplo n.º 1
0
        public void UpdateFile(Guid spId, Guid newFileId)
        {
            var spf = spfRepo.GetItem(x => x.SpecialTaskId == spId);

            if (spf != null)
            {
                fileService.Delete(spf.FileId);
                spf.FileId = newFileId;
                spfRepo.Update(spf);
            }
            else
            {
                spf = new SpecialTaskFile
                {
                    SpecialTaskId = spId,
                    FileId        = newFileId
                };
                spfRepo.Create(spf);
            }
        }
Exemplo n.º 2
0
        public void Create(Models.SpecialTask st)
        {
            var entity = new SpecialTaskEntity
            {
                Description     = st.Description,
                ScheduleId      = st.ScheduleId,
                SpecialTaskType = (Entities.Enums.SpecialTaskType)(int) st.SpecialTaskType
            };

            entity = repo.CreateItem(entity);

            if (st.FileId != Guid.Empty)
            {
                var spf = new SpecialTaskFile
                {
                    FileId        = st.FileId,
                    SpecialTaskId = entity.Id
                };
                spfRepo.Create(spf);
            }
        }