예제 #1
0
        public static IssueEF UpdateFromDetached(this IssueEF AttachedEF, IssueEF DetachedEF)
        {
            if (AttachedEF is null)
            {
                throw new ArgumentNullException(nameof(AttachedEF));
            }

            if (DetachedEF is null)
            {
                throw new ArgumentNullException(nameof(DetachedEF));
            }

            if (AttachedEF.Id != DetachedEF.Id)
            {
                throw new Exception("Cannot update ComponentEF entity as it is not the same.");
            }

            if ((AttachedEF != default) && (DetachedEF != default))
            {
                AttachedEF.Description   = DetachedEF.Description;
                AttachedEF.ComponentType = DetachedEF.ComponentType;
                AttachedEF.Archived      = DetachedEF.Archived;
                AttachedEF = AttachedEF.FillFromMultiLanguageString(DetachedEF.ExtractToMultiLanguageString());
            }

            return(AttachedEF);
        }
예제 #2
0
        public bool Remove(IssueEF entity)
        {
            if (entity is null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            return(Remove(entity.Id));
        }
예제 #3
0
        public IssueEF MarkAsCompleted(int IssueId, int UserId)
        {
            IssueEF issue = unitOfWork.IssuesRepository.GetById(IssueId);
            UserEF  user  = unitOfWork.UserRepository.GetById(UserId);

            issue.IsCompleted = true;
            var result = unitOfWork.IssuesRepository.Update(issue);

            return(result);
        }
예제 #4
0
        public IssueEF BecomeResolver(int IssueId, int UserId)
        {
            IssueEF issue = unitOfWork.IssuesRepository.GetById(IssueId);
            UserEF  user  = unitOfWork.UserRepository.GetById(UserId);

            issue.Resolver = user;
            var result = unitOfWork.IssuesRepository.Update(issue);

            return(result);
        }
예제 #5
0
        public IssueEF Update(IssueEF Entity)
        {
            if (Entity is null)
            {
                throw new ArgumentNullException(nameof(Entity));
            }

            return(issuesContext
                   .Issues
                   .Update(Entity)
                   .Entity);
        }
예제 #6
0
        public IssueEF Add(IssueEF Entity)
        {
            if (Entity is null)
            {
                throw new ArgumentNullException(nameof(Entity));
            }

            var result = issuesContext.Issues.Add(Entity);

            issuesContext.SaveChanges();
            return(result.Entity);
        }
예제 #7
0
        public static IssueTO ToTranfertsObject(this IssueEF Issue)
        {
            if (Issue is null)
            {
                throw new ArgumentNullException(nameof(Issue));
            }

            return(new IssueTO
            {
                Id = Issue.Id,
                Name = new MultiLanguageString(Issue.NameEnglish, Issue.NameFrench, Issue.NameDutch),
            });
        }
예제 #8
0
        public static IssueTO ToTransfertObject(this IssueEF Issue)
        {
            if (Issue is null)
            {
                throw new NullIssueException(nameof(Issue));
            }

            return(new IssueTO
            {
                Id = Issue.Id,
                Name = new MultiLanguageString(Issue.NameEnglish, Issue.NameFrench, Issue.NameDutch),
                ComponentType = Issue.ComponentType.ToTransfertObject(),
                Archived = Issue.Archived,
                Description = Issue.Description,
            });
        }
예제 #9
0
        public static IssueTO ToTransfertObject(this IssueEF issue)
        {
            if (issue is null)
            {
                throw new ArgumentNullException(nameof(issue));
            }

            return(new IssueTO
            {
                IssueId = issue.IssueId,
                Creator = issue.Creator,
                Resolver = issue.Resolver,
                Priority = issue.Priority,
                Name = issue.Name,
                DeadLine = issue.DeadLine,
                IsCompleted = issue.IsCompleted,
                IsSoftDeleted = issue.IsSoftDeleted,
                Location = issue.Location,
                Sector = issue.Sector,
                Description = issue.Description
            });
        }
예제 #10
0
 public IssueEF AddIssue(IssueEF Issue)
 => unitOfWork.IssuesRepository.Add(Issue);
예제 #11
0
 public IssueEF Add([FromBody] IssueEF Issue)
 {
     return(_UserRole.AddIssue(Issue));
 }