public DifficultyListResponse getDifficultyAll() { DifficultyListResponse response = new DifficultyListResponse(); QuestionProjeEntities db = new QuestionProjeEntities(); db.Configuration.ProxyCreationEnabled = false; try { response.difficultys = db.Difficulty.Where(r => r.State == true).ToList(); } catch (Exception ex) { //bir hata olursa response set edilsin Helper.setErrorToResponse(Constant.ERRORCODE.SYS_SYSTEM_ERROR, response); return(response); } //başarılı olduğu response a set edilsin Helper.setErrorToResponse(Constant.ERRORCODE.SYS_SUCCESS, response); return(response); }
public DifficultyListResponse addDifficulty(Difficulty difficulty) { DifficultyListResponse response = new DifficultyListResponse(); QuestionProjeEntities db = new QuestionProjeEntities(); try { db.Difficulty.Add(difficulty); db.SaveChanges(); response.difficultys.Add(difficulty); } catch (Exception ex) { //bir hata olursa response set edilsin Helper.setErrorToResponse(Constant.ERRORCODE.SYS_SYSTEM_ERROR, response); return(response); } //başarılı olduğu response a set edilsin Helper.setErrorToResponse(Constant.ERRORCODE.SYS_SUCCESS, response); return(response); }
public DifficultyListResponse deleteDifficulty(int ID) { DifficultyListResponse response = new DifficultyListResponse(); QuestionProjeEntities db = new QuestionProjeEntities(); try { db.Configuration.ProxyCreationEnabled = false; Difficulty difficulty = db.Difficulty.Where(r => r.ID == ID).SingleOrDefault(); difficulty.State = false; db.SaveChanges(); response.difficultys.Add(difficulty); } catch (Exception ex) { //bir hata olursa response set edilsin Helper.setErrorToResponse(Constant.ERRORCODE.SYS_SYSTEM_ERROR, response); return(response); } //başarılı olduğu response a set edilsin Helper.setErrorToResponse(Constant.ERRORCODE.SYS_SUCCESS, response); return(response); }