db operation in view fucntion