コード例 #1
0
 public void CreatedProjects(string title, string details, DateTime?expetedCompletionDate, int?tenantId)
 {
     DAL.Models.ProjectCoreContext _context = new DAL.Models.ProjectCoreContext();
     _context.Projects.Add(new DAL.Models.Projects
     {
         Title   = title,
         Details = details,
         ExpectedCompletionDate = expetedCompletionDate,
         TenantId  = tenantId,
         CreatedAt = DateTime.Now
     });
     _context.SaveChangesAsync();
 }
コード例 #2
0
        public void DeleteProjects(int?id)
        {
            DAL.Models.ProjectCoreContext _context = new DAL.Models.ProjectCoreContext();

            if (_context.Artifacts.Any(x => x.ProjectId == id) || _context.UserProjects.Any(x => x.ProjectId == id))
            {
                return;
            }
            var projectEF = _context.Projects.Where(x => x.Id == id).FirstOrDefault();

            _context.Projects.Remove(projectEF);

            _context.SaveChangesAsync();
        }
コード例 #3
0
        public void UpdateProjects(int id,
                                   string title,
                                   string details,
                                   DateTime?expectedCompletionDate
                                   )
        {
            DAL.Models.ProjectCoreContext _context = new DAL.Models.ProjectCoreContext();
            var projectEF = _context.Projects.Where(x => x.Id == id).FirstOrDefault();

            projectEF.Title   = title;
            projectEF.Details = details;
            projectEF.ExpectedCompletionDate = expectedCompletionDate;
            projectEF.UpdatedAt = DateTime.Now;



            _context.SaveChangesAsync();
        }