public IActionResult GenerateOTP(GenerateOTPReq req) { BaseResponse resp = new BaseResponse(); try { if (RequestValidator.GenerateOTP(req)) { if (UserCRUD.IsValidUser(req.user_id)) { var device = DeviceCRUD.GetDevice(req.device_id, req.user_id, req.os_type); if (device == null) { device = new RegisteredDevice() { DeviceId = req.device_id, UserId = req.user_id, OsType = req.os_type, LastUpdate = DateTime.Now, Otp = "1111" }; } DeviceCRUD.AddDeviceIfNotExist(device); resp.status_code = Ok().StatusCode; resp.status_message = StatusMessage.Success; } else { resp.status_code = Unauthorized().StatusCode; resp.status_message = StatusMessage.UnAuthorised; } } else { resp.status_code = BadRequest().StatusCode; resp.status_message = StatusMessage.BadRequest; } } catch (Exception es) { resp.status_code = 500; resp.status_message = StatusMessage.InternalServerError; } return(Ok(resp)); }