public void EditDefect(Defect defect) { try { using (var dbContext = new DefectTrackerContext()) { var existingDefect = dbContext.Defects.FirstOrDefault(d => d.Id == defect.Id); if (existingDefect == null) { return; } existingDefect.UserAssignedId = defect.UserAssignedId; existingDefect.DefectDescription = defect.DefectDescription; existingDefect.DefectTitle = defect.DefectTitle; existingDefect.ModifiedDate = DateTime.Now; existingDefect.ResolutionDate = defect.ResolutionDate; existingDefect.StatusId = defect.StatusId; dbContext.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public static void AddDefect(Defect defect) { using (var dbContext = new DefectTrackerContext()) { dbContext.Defects.Add(defect); dbContext.SaveChanges(); } }
public void AddUsers(Users Users) { using (var dbContext = new DefectTrackerContext()) { try { dbContext.Users.Add(Users); dbContext.SaveChanges(); } catch (Exception ex) { throw ex; } } }
public void AddDefectStatus(DefectStatus defectStatus) { using (var dbContext = new DefectTrackerContext()) { try { dbContext.DefectStatus.Add(defectStatus); dbContext.SaveChanges(); } catch (Exception ex) { throw ex; } } }
public void DeleteDefect(int DefectId) { try { using (var dbContext = new DefectTrackerContext()) { var Defect = dbContext.Defects .Where(d => d.Id == DefectId) .FirstOrDefault(); dbContext.Entry(Defect).State = System.Data.Entity.EntityState.Deleted; dbContext.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void DeleteUsers(int UsersId) { try { using (var dbContext = new DefectTrackerContext()) { var Users = dbContext.Users .Where(u => u.Id == UsersId) .FirstOrDefault(); dbContext.Entry(Users).State = System.Data.Entity.EntityState.Deleted; dbContext.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void DeleteDefectStatus(int defectStatusId) { try { using (var dbContext = new DefectTrackerContext()) { var defectStatus = dbContext.DefectStatus .Where(s => s.Id == defectStatusId) .FirstOrDefault(); dbContext.Entry(defectStatus).State = System.Data.Entity.EntityState.Deleted; dbContext.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void EditDefectStatus(DefectStatus defectStatus) { try { using (var dbContext = new DefectTrackerContext()) { var existingStatus = dbContext.DefectStatus.Where(s => s.Id == defectStatus.Id).FirstOrDefault <DefectStatus>(); if (existingStatus != null) { existingStatus.Status = defectStatus.Status; dbContext.SaveChanges(); } } } catch (Exception ex) { throw ex; } }
public void EditUsers(Users Users) { try { using (var dbContext = new DefectTrackerContext()) { var existingUser = dbContext.Users.Where(u => u.Id == Users.Id).FirstOrDefault <Users>(); if (existingUser != null) { existingUser.Name = Users.Name; existingUser.IsAdmin = Users.IsAdmin; dbContext.SaveChanges(); } } } catch (Exception ex) { throw ex; } }