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); }
public bool Remove(IssueEF entity) { if (entity is null) { throw new ArgumentNullException(nameof(entity)); } return(Remove(entity.Id)); }
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); }
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); }
public IssueEF Update(IssueEF Entity) { if (Entity is null) { throw new ArgumentNullException(nameof(Entity)); } return(issuesContext .Issues .Update(Entity) .Entity); }
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); }
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), }); }
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, }); }
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 }); }
public IssueEF AddIssue(IssueEF Issue) => unitOfWork.IssuesRepository.Add(Issue);
public IssueEF Add([FromBody] IssueEF Issue) { return(_UserRole.AddIssue(Issue)); }