Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
 public static void AddDefect(Defect defect)
 {
     using (var dbContext = new DefectTrackerContext())
     {
         dbContext.Defects.Add(defect);
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void AddUsers(Users Users)
 {
     using (var dbContext = new DefectTrackerContext())
     {
         try
         {
             dbContext.Users.Add(Users);
             dbContext.SaveChanges();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
Exemplo n.º 4
0
 public void AddDefectStatus(DefectStatus defectStatus)
 {
     using (var dbContext = new DefectTrackerContext())
     {
         try
         {
             dbContext.DefectStatus.Add(defectStatus);
             dbContext.SaveChanges();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
Exemplo n.º 5
0
        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;
            }
        }
Exemplo n.º 6
0
        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;
            }
        }
Exemplo n.º 7
0
        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;
            }
        }
Exemplo n.º 8
0
        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;
            }
        }
Exemplo n.º 9
0
        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;
            }
        }