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(); }
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(); }
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(); }