Bugfix ifelse to switchcase

Enhancement of return handling from db, ifesle to switch etc - Please look into this commit and review. (Ignore the last two commits for review purpose)

1. Changed the file name of api's to not have API keyword
2. Added constants for DB status return for SP queries
3. optimized return of each functions by comibing render/redirect and return into one line