public int updateDefect(DefectServiceModel defect)
 {
     DefectsRepository repo = new DefectsRepository(entities);
     throw new NotImplementedException();
 }
 public void deleteDefect(int id)
 {
     DefectsRepository repo = new DefectsRepository(entities);
     Defect defect = repo.Get(id);
     repo.Delete(defect);
 }
 public int insertDefect(DefectServiceModel defect)
 {
     DefectsRepository repo = new DefectsRepository(entities);
     Defect model = new Defect();
     model.CreateDate = DateTime.Now;
     model.Description = defect.description;
     model.Id = 0;
     model.LastUpdatedDate = DateTime.Now;
     model.Serverity = DefectUtil.unmapDefectToServerity(defect.serverity);
     model.Status = DefectUtil.unmapDefectToStatus(defect.status);
     model.Subject = defect.subject;
     return repo.Insert(model);
 }
        public IEnumerable<DefectServiceModel> getDefectsByStatus(string text)
        {
            DefectsRepository repo = new DefectsRepository(entities);
            List<DefectServiceModel> models = new List<DefectServiceModel>();
            IEnumerable<Defect> defects = repo.FindAllDefectsByStatus(DefectUtil.unmapDefectToStatus(text));

            foreach (Defect defect in defects) {
                models.Add(DefectUtil.mapDefectEntityToModel(defect));
            }

            return models;
        }
        public IEnumerable<DefectServiceModel> getDefectsByAuthor(int id)
        {
            DefectsRepository repo = new DefectsRepository(entities);
            List<DefectServiceModel> models = new List<DefectServiceModel>();
            IEnumerable<Defect> defects = repo.FindAllDefectsByAuthor(id);

            foreach (Defect defect in defects) {
                models.Add(DefectUtil.mapDefectEntityToModel(defect));
            }

            return models;
        }
        public IEnumerable<DefectServiceModel> getDefectsBeforeDate(DateTime dateTimeStamp)
        {
            DefectsRepository repo = new DefectsRepository(entities);
            List<DefectServiceModel> models = new List<DefectServiceModel>();
            IEnumerable<Defect> defects = repo.FindAllDefectsBeforeDate(dateTimeStamp);

            foreach (Defect defect in defects) {
                models.Add(DefectUtil.mapDefectEntityToModel(defect));
            }

            return models;
        }
 public DefectServiceModel getDefect(int id)
 {
     DefectsRepository repo = new DefectsRepository(entities);
     Defect defect = repo.Get(id);
     return DefectUtil.mapDefectEntityToModel(defect);
 }